<html lang="zh-CN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<body class="nodata " style="">
<main style="width:100%">
<div class="blog-content-box">
<div class="article-title-box">
<h1 class="title-article" id="articleContentId">WPSJS加载项在线模式和离线模式</h1>
</div><div id="article_content" class="article_content clearfix">
<link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css">
<link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-044f2cf1dc.css">
<div id="content_views" class="htmledit_views">
<h3 style="margin-left:.0001pt;text-align:justify;"><a name="t0"></a>1、模式介绍</h3>
<p style="margin-left:.0001pt;text-align:justify;"> <a href="https://so.csdn.net/so/search?q=WPS&spm=1001.2101.3001.7020" target="_blank" class="hl hl-1" data-report-click="{"spm":"1001.2101.3001.7020","dest":"https://so.csdn.net/so/search?q=WPS&spm=1001.2101.3001.7020","extra":"{\"searchword\":\"WPS\"}"}" data-tit="WPS" data-pretit="wps">WPS</a>加载项分为在线模式和离线模式,两个模式同时只能启用一个。离线模式是在加载项项目运行前,将其下载到本地进行运行,在线模式一直在去请求服务器上的代码和页面</p>
<p style="margin-left:.0001pt;text-align:justify;">通俗解释:</p>
<p style="margin-left:.0001pt;text-align:justify;">打开浏览器,进入任何一个页面,ctrl+s保存网页。</p>
<p style="margin-left:.0001pt;text-align:justify;">直接在浏览器中打开的那个网页就叫做在线模式。</p>
<p style="margin-left:.0001pt;text-align:justify;">运行保存到本地的那个网页,就叫做离线模式。</p>
<p style="margin-left:.0001pt;text-align:justify;"></p>
<h3 style="margin-left:.0001pt;text-align:justify;"><a name="t1"></a>2、模式详情</h3>
<h4><a name="t2"></a>2.1、在线模式</h4>
<p style="margin-left:.0001pt;text-align:justify;"> 在线模式是JSAPI的加载项部署在服务器上面,提供给WPS一个下载地址,WPS在打开的时候动态下载该加载项,并显示到WPS界面。</p>
<ul><li style="text-align:justify;">标签:jspluginonline</li><li style="text-align:justify;">访问方式:实时在线访问</li><li style="text-align:justify;"><span style="color:#000000;">具体实现:</span></li></ul>
<p class="img-center"><img alt="" height="88" src="https://img-blog.csdnimg.cn/a603a23511604bc5a514e7884c609c43.png" width="554"></p>
<ul><li>name:加载项的名称,启动时需将名称传递正确</li><li>type:加载项的类型</li><li><span style="color:#000000;">url:加载项的网络访问地址</span><span style="color:#000000;">,</span><span style="color:#000000;">指向加载项的根目录</span><span style="color:#000000;">,需要保证 url</span><span style="color:#000000;">下</span><span style="color:#000000;">ribbon.xml和url</span><span style="color:#000000;">下</span><span style="color:#000000;">index.html能够访问</span></li></ul>
<p style="margin-left:.0001pt;text-align:justify;"></p>
<ul><li style="text-align:justify;"><span style="color:#000000;">优点:</span><span style="color:#000000;">适合通过服务器分发的形式,企业私有化部署方案,比如企业内部使用的中心化的服务器,安装WPS的时候配置好加载路径,然后统一从中心服务器下载。</span><span style="color:#000000;">加载比较平滑,用户首次加载或版本更新后的用户初次访问时间会比离线模式高,且每次都是使用最新的代码</span><span style="color:#000000;">。</span></li><li style="text-align:justify;"><span style="color:#000000;">缺点:每次执行时,都是去请求服务器上的资源,</span><span style="color:#000000;">执行速度慢一些,因为要等到加载项下载完成才能显示</span><span style="color:#000000;">,</span><span style="color:#000000;">比较浪费网络资源,并且网络不好时,不能访问。</span></li><li style="text-align:justify;"><span style="color:#000000;">总结:在线模式适合在资源频繁改动,且网络稳定的情况下使用(项目开发阶段)</span></li></ul>
<p style="text-align:justify;"></p>
<ul><li style="margin-left:.0001pt;text-align:justify;"> <h4><a name="t3"></a>2.2、离线模式</h4> </li></ul>
<p style="margin-left:.0001pt;text-align:justify;"> 严格意义来说这种部署属于Publish模式,需要使用wpsjs build命令将WPS打包然后部署。基本介绍如下:</p>
<ul><li style="text-align:justify;">标签:jsplugin</li><li style="text-align:justify;">访问方式:将对应的版本号压缩文件下载到本地,加载项加载时,访问本地加载项项目</li><li style="text-align:justify;">具体实现:</li></ul>
<p class="img-center"><img alt="" height="69" src="https://img-blog.csdnimg.cn/e4d044a622ab4a43ad5e4af16984e2a9.png" width="554"></p>
<p style="margin-left:.0001pt;text-align:justify;"></p>
<ul><li>name:加载项的名称,启动时需将名称传递正确</li><li>type:加载项的类型</li><li>url:加载项的压缩包下载地址,需要保证包的压缩后缀为.7z,且该url能在浏览器中打开并下载压缩包。</li><li>version:包的版本,加载时,jsaddons是否有name+_+version 文件夹,如果有,则使用本地包来执行加载项项目,如果没有,则会去网络上请求新的包,如果网络上下载下来的包解压出来后也和name+_+version 不相等,则不使用加载项
<ul><li>windows</li></ul></li></ul>
<p style="text-align:justify;"> cd ~/.local/share/Kingsoft/wps/jsaddons文件</p>
<p style="margin-left:.0001pt;text-align:justify;"> win + r </p>
<p style="margin-left:.0001pt;text-align:justify;"> 输入%appdata% 回车</p>
<p style="margin-left:.0001pt;text-align:justify;"> 查看kingsoft\wps\jsaddons文件夹,</p>
<p style="text-align:justify;"> Linux</p>
<p style="margin-left:.0001pt;text-align:justify;"> cd ~/.local/share/Kingsoft/wps/jsaddons文件</p>
<p style="margin-left:.0001pt;text-align:justify;"></p>
<ul><li style="text-align:justify;">优点:只要name_version等于加载项文件夹的名字,加载项就不会去更新加载项的包,采用本地的加载项包资源,大大的节省网络资源和用户的时间。</li><li style="text-align:justify;">缺点:初次加载或版本变更时,都会先去下载整个加载项包,并解压,会比较耗费时间</li><li style="text-align:justify;">总结:离线模式适合资源改动不频繁的情况(项目发布阶段)</li></ul>
<p style="margin-left:.0001pt;text-align:justify;"></p>
<h4 style="margin-left:.0001pt;text-align:justify;"><a name="t4"></a>2.3、特殊离线模式</h4>
<p style="margin-left:.0001pt;text-align:justify;"> 这种模式是针对电脑不联网的情况下(包括内网),希望能够直接发送插件包给
20240514tySrC4V3.zip
需积分: 0 44 浏览量
2024-05-14
08:42:36
上传
评论
收藏 10KB ZIP 举报
2401_85016753
- 粉丝: 0
- 资源: 1
最新资源
- 一个基于 React、Dva、DataV、ECharts 框架的大数据可视化平台 支持数据动态刷新渲染、屏幕适配
- WordPress响应式简约博客主题Alt-Blog主题
- 46核心知识点四十六: H(z)零极点与系统因果稳定性(8772342).vip
- 233513264879476androidfiletransfer.dmg.zip
- 电影TensorFlow推荐系统
- STM32驱动SD卡SPI方式源码(Keil5打开)
- 基于SpringBoot的商城购物网站系统毕业设计源码+数据库(高分项目)
- LAMP.iso (7.4)可使用
- btstack协议栈实战篇-GAP Classic Inquiry
- 高炉瓦斯灰的铁铝再利用研究开题报告
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈