<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>pdfh5.js     </title><link>https://pdfh5.gjtool.cn/</link><description>前端技术博客</description><item><title>canvasPlot.js 一个canvas绘制矩形的插件，自由拖动缩放</title><link>https://pdfh5.gjtool.cn/?id=10</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1 id=&quot;h1-canvasPlot-3&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;canvasPlot&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;canvasPlot&lt;/h1&gt;&lt;p&gt;&lt;a href=&quot;https://www.npmjs.com/package/canvasplot&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;npm version&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/npm/v/canvasplot.svg&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://www.npmjs.com/package/canvasplot&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;npm downloads&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/npm/dt/canvasplot.svg&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://www.npmjs.com/package/canvasplot&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;npm downloads&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/npm/dw/canvasplot.svg&quot;&gt;&lt;/a&gt;  &lt;a href=&quot;https://github.com/gjTool/canvasplot/blob/master/LICENSE&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;MIT&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/badge/License-MIT-blue.svg&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/gjTool/canvasplot/issues&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;GitHub issues&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/github/issues/gjTool/canvasplot.svg&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/gjTool/canvasplot/stargazers&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;GitHub stars&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/github/stars/gjTool/canvasplot.svg?style=social&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/gjTool/canvasplot/network/members&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;GitHub forks&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/github/forks/gjTool/canvasplot.svg?style=social&quot;&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;canvasplot.js canvas绘制矩形，拖动缩放，删除。&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.gjtool.cn/&quot;&gt;canvasplot博客主页&lt;/a&gt;  &lt;/p&gt;
&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/gjTool/canvasplot&quot;&gt;canvasplot项目GitHub地址&lt;/a&gt;  &lt;/p&gt;
&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://gitee.com/gjTool/canvasplot&quot;&gt;canvasplot项目gitee地址&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3 id=&quot;h3-u5728u7EBFu793Au4F8B-15&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;在线示例&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;在线示例&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;https://www.gjtool.cn/canvasplot/index.html&quot;&gt;https://www.gjtool.cn/canvasplot/index.html&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-u5FEBu901Fu4F7Fu7528uFF08u6709u4E24u79CDu65B9u5F0FuFF09-19&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;快速使用（有两种方式）&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;快速使用（有两种方式）&lt;/h2&gt;&lt;h4 id=&quot;h4-u4E00u3001scriptu6807u7B7Eu5F15u5165u65B9u5F0F-21&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;一、script标签引入方式&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;一、script标签引入方式&lt;/h4&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;&amp;lt;div id=&quot;demo&quot; style=&quot;width:500px;height:500px;&quot;&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;3.引入js&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;&amp;lt;script src=&quot;canvasPlot.min.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;4.实例化&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;var canvasPlot = new CanvasPlot({
parentNode: document.querySelector(&quot;#demo&quot;),
width: 500,
height: 500,
imagePath: '3.jpg'
});
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;h4-u4E8Cu3001npmu5B89u88C5u65B9u5F0F-45&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;二、npm安装方式&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;二、npm安装方式&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;1.安装&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;npm install canvasplot
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;2.使用&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;&amp;lt;template&amp;gt;
  &amp;lt;div id=&quot;app&quot;&amp;gt;
&amp;lt;div id=&quot;demo&quot; style=&quot;width:500px;height:500px;&quot;&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;script&amp;gt;
import CanvasPlot from &quot;canvasplot&quot;;
export default {
    name: 'App',
data() {
  return {
  };
},
mounted() {
var canvasPlot = new CanvasPlot({
parentNode: document.querySelector(&quot;#demo&quot;),
width: 500,
height: 500,
imagePath: '3.jpg'
});

canvasPlot.addRect({
x: 212,
y: 119,
w: 50,
h: 50
});
canvasPlot.addRect({
x: 280,
y: 126,
w: 60,
h: 30
});
canvasPlot.drawRectBegin();
canvasPlot.on(&quot;drawFinish&quot;,function(){
//somecode
})
}
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;h2-optionsu914Du7F6Eu9879u53C2u6570u5217u8868-97&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;options配置项参数列表&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;options配置项参数列表&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style=&quot;text-align:center&quot;&gt;参数名称&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;类型&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;取值&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;是否必须&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;作用&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;parentNode&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;HTMLelement&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;√&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;canvasPlot的父元素&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;width&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Number&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;canvasPlot的宽，不填默认跟随父元素宽度&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;height&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Number&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;canvasPlot的高，不填默认跟随父元素高度&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;imagePath&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;String&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;canvasPlot的图片路径&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;showMenu&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Boolean&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;是否显示右键菜单&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;rectBgColor&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;String&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;rect矩形内部填充颜色，不填默认中间透明&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;h2-methods20u65B9u6CD5u5217u8868-107&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;methods 方法列表&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;methods 方法列表&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style=&quot;text-align:center&quot;&gt;方法名&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;传参&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;传参取值&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;作用&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;addRect&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Object&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;{x:10,y:10,w:40,h:40}&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;手动添加矩形&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;delPlot&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Object&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;plot&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;删除plot，不传参默认删除所有plot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;drawRectBegin&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;开始绘制矩形&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;drawRectFinish&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;结束绘制矩形&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;setCanvasDragZoom&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Boolean&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;true/false&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;设置允许拖动缩放&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;getPlotCaches&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;获取绘制的plot数据缓存&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;getSelection&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;获取当前选中的plot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;getOffset&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;获取当前canvas偏移值，放大比例{scale:1,x:0,y:0}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;setOffset&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Object&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;{scale:1,x:0,y:0}&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;设置当前canvas偏移值，放大比例&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;getData&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;-&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;获取canvasPlot的默认绘制plot数据,偏移值和缩放比例。{offset:{scale:1,x:0,y:0},data:[]}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;setData&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;Object&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;{offset:{scale:1,x:0,y:0},data:[]}&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;canvasPlot的默认绘制plot数据,偏移值和缩放比例（可以用来回显上次的数据&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;screenshot&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;String&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;jpg/png等图片格式&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;当前canvas截图，返回base64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;downLoad&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;String&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;jpg/png等图片格式&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;当前canvas截图，下载下来成为图片文件&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;on&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;(String, Function, Boolean)&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;String：监听的事件名，Function：监听的事件回调, Boolean: 为true时，不可与同类型的事件共存，当前事件函数会覆盖前面同类型的事件&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;on方法监听所有事件，所有类型事件默认可以同时存在多个，触发事件时会同时执行&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;off&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;(String, Function)&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;String：要卸载的事件名，Function：要卸载的事件函数&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;off方卸载on监听的所有事件，第一个参数为true时，卸载所有on监听的事件。第二个参数为空时，卸载第一个参数的同类型的所有事件&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;h2-onu65B9u6CD5u76D1u542Cu6240u6709u4E8Bu4EF6-u4E8Bu4EF6u540Du5217u8868-128&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;on方法监听所有事件-事件名列表&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;on方法监听所有事件-事件名列表&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style=&quot;text-align:center&quot;&gt;事件名&lt;/th&gt;
&lt;th style=&quot;text-align:center&quot;&gt;作用&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;drawFinish&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听plot绘制完成&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;dragMoveFinish&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听背景图拖拽完成&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;dragPlotMove&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听plot拖拽完成&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;drawing&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听plot绘制中&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;drawMove&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听plot绘制中（四角边沿拖拽绘制）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;select&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听plot选择事件&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;zoom&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听缩放事件&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;dblclick&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听plot双击事件&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align:center&quot;&gt;rightClick&lt;/td&gt;
&lt;td style=&quot;text-align:center&quot;&gt;监听plot右键事件&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/body&gt;</description><pubDate>Thu, 03 Mar 2022 10:00:58 +0800</pubDate></item><item><title>vue-layer修复版vl-layer，一款好用的vue弹窗组件，layui-layer弹窗风格</title><link>https://pdfh5.gjtool.cn/?id=15</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://www.npmjs.com/package/vl-layer&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;npm version&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/npm/v/vl-layer.svg&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://www.npmjs.com/package/vl-layer&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;npm downloads&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/npm/dt/vl-layer.svg&quot;&gt;&lt;/a&gt;   &lt;a href=&quot;https://github.com/gjTool/vl-layer/blob/master/LICENSE&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;MIT&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/badge/License-MIT-blue.svg&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/gjTool/vl-layer/issues&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;GitHub issues&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/github/issues/gjTool/vl-layer.svg&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/gjTool/vl-layer/stargazers&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;GitHub stars&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/github/stars/gjTool/vl-layer.svg?style=social&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://github.com/gjTool/vl-layer/network/members&quot;&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;GitHub forks&quot; alt=&quot;null&quot; src=&quot;https://img.shields.io/github/forks/gjTool/vl-layer.svg?style=social&quot;&gt;&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt; &lt;strong&gt;vue-layer修复版vl-layer，一款好用的vue弹窗组件，layui-layer弹窗风格&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;起初使用vue-layer，但是奈何bug太多，作者又没有时间修复，所以只能自己动手修改源码，添加自己想要的功能，修改了图标，索性发布到npm上，这样也能帮到其他想用vue-layer的同学。&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/gjTool/vl-layer&quot;&gt;vl-layer github地址&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://gitee.com/gjTool/vl-layer&quot;&gt;vl-layer gitee地址&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/zuoyanart/vue-layer&quot;&gt;原版vue-layer github地址&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-u66F4u65B0u4FE1u606F-11&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;更新信息&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;更新信息&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;2021.06.18 更新： 新增parentDom属性，弹窗的父元素，弹窗创建后会append到父元素&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-u5FEBu901Fu4F7Fu7528-14&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;快速使用&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;快速使用&lt;/h2&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm install vl-layer
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;main.js里&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;import Vue from 'vue';
import layer from 'vl-layer'
import 'vl-layer/vl-layer.css';

Vue.prototype.$layer = layer(Vue);
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;vue文件里&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;&amp;lt;template&amp;gt;
  &amp;lt;div id=&quot;app&quot;&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;script&amp;gt;
  import world from &quot;@/components/HelloWorld.vue&quot;
  export default {
    name: 'App',
components:{
  world
},
data() {
  return {

  };
},
mounted() {
//iframe层并不是真的用了html标签iframe,实质上还是用的div,只是iframe层可以引用自定义组件、页面
let layerId = this.$layer.iframe({
   title:&quot;提示&quot;,
   content:{
     content:world, //组件
     parent:this, //vue实例 传入实例 弹窗组件内才能获取laydata
     data:{
 a:&quot;这是父组件传值&quot;, //父组件向弹窗子组件传值
 b:{},
 c:function(){}
 } 
   },
   canmove:false,  //true可以拖动 false不能拖动 
   //弹窗成功 id弹窗的id
   success:id=&amp;gt;{
     console.log(&quot;success&quot;,id)
   },
   //弹窗关闭/取消
   end:()=&amp;gt;{
     console.log(&quot;end&quot;)
   },
   //弹窗关闭/取消之前，id弹窗的id close关闭弹窗, return false阻止关闭  return true不阻止    
  // beforeClose:(id,close)=&amp;gt;{
  //   console.log(&quot;beforeClose&quot;,id)
  //   setTimeout(()=&amp;gt;{
 //      close(id)
 //    },2000)
 //    return false
 //  },
  //还原状态回调 id弹窗的id state：1 是由最小化还原 2是由最大化还原
  maxminiCallback:(id,state)=&amp;gt;{
console.log('maxminiCallback', id,state);
  },
  //最小化回调 id弹窗的id
  miniCallback: id =&amp;gt; {
console.log('miniCallback', id);
  },
  //最大化回调 id弹窗的id
  maxCallback: id =&amp;gt; {
console.log('maxCallback', id);
  }
 })
}
  }
&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;HelloWorld.vue&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;&amp;lt;template&amp;gt;
  &amp;lt;div calss=&quot;HelloWorld&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;script&amp;gt;
  export default {
    name: 'HelloWorld',
props:{
//本弹窗的id
layerid:{
type:String,
default:&quot;&quot;
},
//父组件的data
lydata:{
type:Object,
default:()=&amp;gt;{
return {}
}
},
//父组件传值
a:{
type:String,
default:&quot;&quot;
},
b:{
type:Object,
default:{}
},
c:{
type:Function,
default:()=&amp;gt;{}
}
},
data() {
  return {

  };
},
mounted() {

}
  }
&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;h2-Attribut-147&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;Attribut&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;Attribut&lt;/h2&gt;&lt;p&gt;-（注意1：信息框，页面层,iframe层,加载层,tips层下各种具体配置参数会有差别，可以看后面各自的配置）&lt;/p&gt;
&lt;p&gt;-（注意2：iframe层并不是真的用了html标签iframe,实质上还是用的div,只是iframe层可以引用自定义组件、页面）&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt; {
   type: 0, //0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
   title: '信息',
   content: '', //文本，标签，iframe层可以传递vue组件对象
   area: 'auto',//['400px','300px'] 
   offset: 'auto',//[20,10] &quot;rightTop&quot; &quot;rightBottom&quot; &quot;leftTop&quot; &quot;leftBottom&quot; {left:0,top:0}  {left:0,bottom:0}  {right:0,bottom:0} {right:0,top:0}
   icon: -1,
   btn: '确定',//[‘确定’，‘取消’]
   time: 0,
   shade: true,//是否显示遮罩
   yes: ()=&amp;gt;{},//确定回调
   cancel: ()=&amp;gt;{},//取消，右上角x关闭按钮回调
   tips: [0,{}],//支持上右下左四个方向，通过1-4进行方向设定,可以设定tips: [1, '#c00']
   tipsMore: false,//是否允许多个tips
   shadeClose: true,//点击遮罩是否关闭
   maxmin: true,//开启最大化最小化
   minBtnOnly:true, //默认false 在  maxmin: true前提下，开启minBtnOnly表示只显示最小化按钮
   scrollbar: true, //是否允许浏览器出现滚动条:默认是允许
   resize: false ,//是否允许拉伸，默认是不允许
   parentDom: HTMLdiv,//html DOM元素，弹窗所在的父元素
   resizeOptions:{
   icon:true , //是否显示右下角图标 默认显示 false隐藏
   dom:true, //是否开启右下角拉伸 
   right:false, //是否开启右边界拉伸 
   bottom:false //是否开启底部边界拉伸 
   },
   //新增参数
   canmove:false,  //true可以拖动 false不能拖动
 //弹窗成功 id弹窗的id
 success:id=&amp;gt;{
   console.log(&quot;success&quot;,id)
 },
 //弹窗关闭/取消
 end:()=&amp;gt;{
   console.log(&quot;end&quot;)
 },
//还原状态回调 id弹窗的id state：1 是由最小化还原 2是由最大化还原
maxminiCallback:(id,state)=&amp;gt;{
console.log('maxminiCallback', id,state);
},
//最小化回调 id弹窗的id
miniCallback: id =&amp;gt; {
console.log('miniCallback', id);
},
//最大化回调 id弹窗的id
maxCallback: id =&amp;gt; {
console.log('maxCallback', id);
},
//弹窗关闭/取消之前，id弹窗的id close关闭弹窗, return false阻止关闭  return true不阻止
  beforeClose:(id,close)=&amp;gt;{
console.log(&quot;beforeClose&quot;,id)
setTimeout(()=&amp;gt;{
  close(id)
},2000)
return false
  }
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;h2-Method-211&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;Method&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;Method&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;alert示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-alert.png&quot;&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt; this.$layer.alert(content, [options, yes]);
 // options和yes可以省略， 如果您不愿意写options，则可以直接写确定按钮的函数，即yes
 // content 可以为html
 //yes如果是个function，这会自动添加参数layerid，
 (layerid)=&amp;gt;{
   this.$layer.close(layerid);
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;confirm示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-confirm.png&quot;&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt; this.$layer.confirm(content, [options, yes, cancel]);
  // options，yes和cancel可以省略， 如果您不愿意写options，则可以直接写确定按钮的函数，即yes，或者覆盖默认的cancel方法。PS：yes和cancel方法不能互换
  //content 可以为html
   //yes,cancel如果是个function，这会自动添加参数layerid，
 (layerid)=&amp;gt;{
   this.$layer.close(layerid);
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;loading示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-loading1.png&quot;&gt;&lt;br&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;loading示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-loading2.png&quot;&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt; this.$layer.loading(option);
  // options ={time:3}，3秒自动关闭
  //options = {content:'请等待'} //可传入文字
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;msg示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-msg.png&quot;&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt; this.$layer.msg(content, [options, end]);
 // options和end可以省略， 如果您不愿意写options，则可以直接写时间到期的回调即可，即end方法
 // 默认msg的关闭时间为1.5秒
 // content 可以为html
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;prompt示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-prompt.png&quot;&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt; this.$layer.prompt(options, yes);
 //特殊参数: value 要回显的值
 //formType: 1text,2password,3textarea
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;tips示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-tips.png&quot;&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;this.$layer.tips(content, follow, options);
//content 可以为html
//follow对css选择器，用来定位目标
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;iframe示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/images/layer-iframe.png&quot;&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;this.$layer.iframe({
  content: {
    content: componentName, //传递的组件对象
    parent: this,//当前的vue对象
    data:{}//props
  },
  area:['800px','600px'],
  title: 'title'，
  cancel:()=&amp;gt;{//关闭事件
     alert('关闭iframe');
  }
});
// data参数可认为是componentName的props，同时 该方法会自动添加一个key为layerid的值， 该值为创建层的id， 可以直接用来关闭该层
// options参数直接写到json里即可，比如title
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;this.$layer.close(layerid);
this.$layer.closeAll(type); // type:'loading' 'alert' 'confirm' 'msg' 'prompt' 'iframe'
//弹窗最大化
this.$layer.full(layerid);
//弹窗最小化
this.$layer.min(layerid);
//还原弹窗
this.$layer.restore(layerid);
//弹窗是否可以拖动 true可以 false不能
this.$layer.canmove(layerid,true)
&lt;/code&gt;&lt;/pre&gt;
&lt;/body&gt;</description><pubDate>Mon, 07 Dec 2020 15:18:44 +0800</pubDate></item><item><title>uniapp实战项目开源，搜索观看影视漫画</title><link>https://pdfh5.gjtool.cn/?id=24</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1 id=&quot;h1-h5uniapp-3&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;h5uniapp&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;h5uniapp&lt;/h1&gt;&lt;p&gt;&lt;strong&gt;h5uniapp 基于uniapp开发的hybrid APP。可以打包成安卓APP、苹果APP、微信小程序、H5&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/gjTool/h5uniapp&quot;&gt;h5uniapp项目GitHub地址&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3 id=&quot;h3-h5uniappu5FAEu4FE1u5C0Fu7A0Bu5E8Fu4E8Cu7EF4u7801-7&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;h5uniapp微信小程序二维码&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;h5uniapp微信小程序二维码&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;h5uniapp微信小程序二维码&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/download/h5uniapp_weixin.jpg&quot;&gt;&lt;/p&gt;
&lt;/li&gt;&lt;li&gt;&lt;p&gt;克隆本项目后，添加到HbuilderX编辑器，就可以真机调试，打包运行了。可以打包成安卓APP、苹果APP、微信小程序、H5。&lt;/p&gt;
&lt;/li&gt;&lt;li&gt;&lt;p&gt;如果有需要影视接口的，可以加群询问，Q群：651601340&lt;/p&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;h5uniapp示例&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/download/h5uniapp.gif&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;h3-h5uniappu5728u7EBFu9884u89C820uFF08u5EFAu8BAEu4F7Fu7528u8C37u6B4Cu6D4Fu89C8u5668F12u624Bu673Au6A21u5F0Fu6253u5F00u9884u89C8uFF09-20&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;h5uniapp在线预览 （建议使用谷歌浏览器F12手机模式打开预览）&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;h5uniapp在线预览 （建议使用谷歌浏览器F12手机模式打开预览）&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gjtool.cn/h5/index.html&quot;&gt;h5uniapp在线预览 &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3 id=&quot;h3-h5uniappu5B89u5353APPu4E0Bu8F7D-25&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;h5uniapp安卓APP下载&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;h5uniapp安卓APP下载&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gjtool.cn/download/h5uniapp.apk&quot;&gt;h5uniapp安卓APP下载&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3 id=&quot;h3-pdfh5u535Au5BA2u4E3Bu9875-33&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;pdfh5博客主页&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;pdfh5博客主页&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gjtool.cn/&quot;&gt;pdfh5博客主页&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/gjTool/pdfh5&quot;&gt;pdfh5项目GitHub地址&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-u6253u8D4Fu8D5Eu52A9u4F5Cu8005uFF1A-38&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;打赏赞助作者：&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;打赏赞助作者：&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;支付宝二维码&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/download/zfb.jpg&quot;&gt; &lt;img style=&quot;max-width:100%;&quot; title=&quot;微信二维码&quot; alt=&quot;null&quot; src=&quot;https://www.gjtool.cn/download/wx.jpg&quot;&gt;&lt;/p&gt;
&lt;/body&gt;</description><pubDate>Thu, 02 Jul 2020 10:00:21 +0800</pubDate></item><item><title>javascript封装animate的过程</title><link>https://pdfh5.gjtool.cn/?id=12</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;首先，我们需要先封装一个css方法，用以获取元素的样式。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;//elem    元素    attr    元素的属性名
function css(elem,attr){
        return elem.currentStyle ? elem.currentStyle[attr]  :   window.getComputedStyle(elem)[attr];
} 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;然后，我们想要一个元素的width动起来，&lt;br&gt;怎么做？给它一个定时器，每隔一段时间改变它的width值，到了想要的值时就清除定时器。如果还想改变别的样式值呢？那么就给这个定时器封装成函数方法，把里面要改变的变成变量，需要用的时候，调用它，传入想改变的样式名就行了。&lt;/p&gt;
&lt;p&gt;此时就有了这样的方法：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;//elem 元素  attr  属性名  value 属性的改变值
function animate(elem,attr,value){
        var timer = setInterval(function(){
                //设置变量start存储元素要改变的样式的初值
                var start = parseInt( css(elem,attr) ),
                       
                //设置变量speed样式改变的速度
                var speed = (value-start)/10;
                //当speed负值或者正值时需要给它取整，以免出现start永远不能等于value的情况
                speed = speed &amp;gt; 0 ? Math.ceil(speed) : Math.floor(speed);
                start += speed;
                if(start == value){
                        clearInterval(timer);
                }else{
                         elem.style[attr] = start + 'px';
                   }
            },13)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是，这样的方法不能实现opacity的改变&lt;br&gt;那么就有了这样的方法：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function animate(elem,attr,value){
        var timer = setInterval(function(){
                //设置变量end存储元素要改变的样式的最终值
                var start = 0, end = 0;
                if(attr ==  'opacity'){
                     //Math.round防止无限小数兼容ie
                    start = Math.round( parseFloat( css(elem,attr) )*100 );
                    end = value*100; 
                }else{
                        start = parseInt( css(elem,attr) );
                        end = value; 
                    }
                var speed = (end-start)/10;
                speed = speed &amp;gt; 0 ? Math.ceil(speed) : Math.floor(speed);
                start += speed;
                if(start == end){
                        clearInterval(timer);
                }else{
                        if(attr == 'opacity'){
                                elem.style.opacity = start/100;
                                 //兼容IE 
                                elem.style.filter='alpha(opacity='+start+')';                          
                         }else{
                                elem.style[attr] = start + 'px';
                             }
                 }
            },13)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这样的方法，只是在元素本身被设置过属性情况下，那如果元素没有设置这个你想要改变的属性呢？&lt;br&gt;我们先来看下，当元素没有设置属性值的时候，CSS方法获取的是什么。&lt;br&gt;比如，获取一个left，css(div,’left’)，有的浏览器会返回0px，但是有的浏览器会返回一个undefined或者auto或者其他他非数字的值；同样，关于opacity这个属性，其他浏览器会返回1，但是IE浏览器会返回一个undefined。&lt;/p&gt;
&lt;p&gt;一般HTML+CSS布局的时候，大家通常会这样写透明度：filter:alpha(opacity=100)；opacity:1;&lt;br&gt;因为IE浏览器的透明度是filter:alpha(opacity=100)；这样的写法就是为了兼容IE的。&lt;/p&gt;
&lt;p&gt;知道了原理，那么，这个animate就可以这样写了： &lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function animate(elem,attr,value){
        var timer = setInterval(function(){
               var start = 0, end = 0;
                if(attr ==  'opacity'){
                    //兼容IE  当没有设置fliter时，默认100；
                    if(!css(elem,attr)){
                           start = 100;
                      }else{
                              start = Math.round( parseFloat( css(elem,attr) )*100 );
                        }
                   end = value*100; 
                }else{
                        //兼容ie 没有设置attr时，默认0（不加parseInt，IE会报错）
                        if(!parseInt(css(elem,attr))){
                            start = 0; 
                        }else{
                               start = parseInt( css(elem,attr) );
                           }
                        end = value; 
                    }
                var speed = (end-start)/10;
                speed = speed &amp;gt; 0 ? Math.ceil(speed) : Math.floor(speed);
                start += speed;
                if(start == end){
                        clearInterval(timer);
                }else{
                        if(attr == 'opacity'){
                                elem.style.opacity = start/100;
                                 //兼容IE 
                                elem.style.filter='alpha(opacity='+start+')';                          
                         }else{
                                elem.style[attr] = start + 'px';
                             }
                 }
            },13)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; 好了，元素单个的属性运动方法已经完毕。&lt;br&gt;那想要多个属性同时运动呢？&lt;br&gt;我们可以把attr和对应的value用对象存起来，比如这样 {width:100,height:100,opacity:1}。然后遍历这个对象，依次改变对象里的属性对应的值，也就是改变了元素的属性值。对象遍历我们用for in 方法。&lt;br&gt;比如，&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;        var json = {width:100,height:100,opacity:1};
           for(var i in json){
                console.log(i)
            } 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;你会发现得到的是width,height,opacity这些字符串。那么json[i]就代表了json对象里的属性值。&lt;br&gt;还有，前面的方法，在实际运用中会出现BUG。因为可能会出现，上一次运动还没完，用户又开始运动，即开了多个定时器的情况。这样就会出现问题。&lt;br&gt;通常做法是在开始运动前就清除定时器，这样就不会出现问题。&lt;br&gt;我们的前面的方法里直接在定时器前面写clearInterval(timer)是不行的，会出错 timer is not defined 。&lt;br&gt;那么我们可以这样，把元素看成一个对象，把timer设置成元素的一个属性 ，即elem.timer。&lt;br&gt;所以，&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function animate(elem,json){
        clearInterval(elem.timer);
        elem.timer = setInterval(function(){
                //遍历json，依次改变每个属性的属性值
               for(var attr in json){
                       var start = 0, end = 0;
                        if(attr ==  'opacity'){
                          //兼容IE 当没有设置fliter时，默认100；
                            if( !css(elem,attr) ){
                                   start = 100;
                              }else{
                                   //Math.round防止出现无限小数
                                  start = Math.round( parseFloat( css(elem,attr) )*100 );
                              }
                              end = parseFloat(json[attr])*100; 
                        }else{
                                 //兼容ie 没有设置attr时，默认0（不加parseInt，IE会报错）
                              if(!parseInt(css(elem,attr))){
                                start = 0; 
                            }else{
                                   start = parseInt( css(elem,attr) );
                              }
                               end =  parseInt(json[attr]); 
                        }
                    var speed = (end-start)/10;
                    speed = speed &amp;gt; 0 ? Math.ceil(speed) : Math.floor(speed);
                    start += speed;
                    if(start == end){
                            clearInterval(elem.timer);
                     }else{
                                if(attr == 'opacity'){
                                elem.style.opacity = start/100;
                                 //兼容IE 
                                elem.style.filter='alpha(opacity='+start+')';                          
                        }else{
                                elem.style[attr] = start + 'px';
                             }           
                } 
        },13)
}    
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这样貌似写完了，其实还没完，这样写会有BUG，会出现只实现了第一个属性的运动，而其他属性的运动没有到达你想要的最终值。因为方法里是这样判定的，当start &lt;mark&gt; end的时候，判定运动终止，但是，现在不止有一个start和end，第一个属性的start&lt;/mark&gt;end完成了，但是后面的属性的start==end并没有完成。&lt;br&gt;所以，我们可以用布尔值来做判定条件。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt; function animate(elem,json){
        clearInterval(elem.timer);
        elem.timer = setInterval(function(){
                //运动终止条件
                var flag = true;
                //遍历json，依次改变每个属性的属性值
               for(var attr in json){
                       var start = 0, end = 0;
                        if(attr ==  'opacity'){
                        //兼容IE 当没有设置fliter时，默认100；
                            if( !css(elem,attr) ){
                                   start = 100;
                              }else{
                                   //Math.round防止出现无限小数
                                  start = Math.round( parseFloat( css(elem,attr) )*100 );
                              }
                              end = parseFloat(json[attr])*100; 
                        }else{
                               //兼容ie 没有设置attr时，默认0（不加parseInt，IE会报错）
                              if(!parseInt(css(elem,attr))){
                                start = 0; 
                            }else{
                                   start = parseInt( css(elem,attr) );
                              }
                               end =  parseInt(json[attr]); 
                        }
                    var speed = (end-start)/10;
                    speed = speed &amp;gt; 0 ? Math.ceil(speed) : Math.floor(speed);
                    start += speed;
                    //当start != end时，flag = false;，运动继续
                    if(start != end){
                            flag = false;
                     }
                      if(attr == 'opacity'){
                           elem.style.opacity = start/100;
                           //兼容IE 
                            elem.style.filter='alpha(opacity='+start+')';                          
                        }else{
                                elem.style[attr] = start + 'px';
                             }           
                } 
                 //当所有的start == end时，flag = true;，运动停止
                if(flag){
                         clearInterval(elem.timer);
                 }
                 
        },13)
}    
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;如果想把animate做成链式运动方法，很简单，只要多加个参数fn,在最后判定运动完成时回调函数就行。改变运动的快慢也很简单，只要再加个参数time。&lt;/p&gt;
&lt;p&gt;所以最终版：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function animate(elem,json,time,fn){
        clearInterval(elem.timer);
        elem.timer = setInterval(function(){
                //运动终止条件
                var flag = true;
                //遍历json，依次改变每个属性的属性值
               for(var attr in json){
                       var start = 0, end = 0;
                        if(attr ==  'opacity'){
                        //兼容IE 当没有设置fliter时，默认100；
                            if( !css(elem,attr) ){
                                   start = 100;
                              }else{
                                   //Math.round防止出现无限小数
                                  start = Math.round( parseFloat( css(elem,attr) )*100 );
                              }
                              end = parseFloat(json[attr])*100; 
                        }else{
                            //兼容ie 没有设置attr时，默认0
                              if( !parseInt(css(elem,attr)) ){
                                start = 0; 
                            }else{
                                   //parseInt防止json对象里属性值带px
                                   start = parseInt( css(elem,attr) );
                              }
                               end =  parseInt(json[attr]); 
                        }
                        //如果有time实参传入，就执行speed = (end-start)/ time ，否则speed = (end-start)/10；
                        var speed = (end-start)/( time || 10 );
                        speed = speed &amp;gt; 0 ? Math.ceil(speed) : Math.floor(speed);
                        start += speed;
                        //当start != end时，flag = false;，运动继续
                        if(start != end){
                            flag = false;
                         }
                          if(attr == 'opacity'){
                           elem.style.opacity = start/100;
                           //兼容IE 
                            elem.style.filter='alpha(opacity='+start+')';                          
                          }else{
                                elem.style[attr] = start + 'px';
                            }           
                } 
                 //当所有的start == end时，flag = true;，运动停止
                if(flag){
                         clearInterval(elem.timer);
                       //运动终止时，如果有函数实参传入就执行回调函数
                        fn &amp;amp; fn(); 
                 }
                 
        },13)
}    
&lt;/code&gt;&lt;/pre&gt;
&lt;/body&gt;</description><pubDate>Mon, 25 May 2020 17:32:47 +0800</pubDate></item><item><title>uniapp画原生图片圆形按钮</title><link>https://pdfh5.gjtool.cn/?id=22</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;pre&gt;&lt;code&gt;//创建锁屏图片
let button1 = new plus.nativeObj.Bitmap('bmp1');
//图片加载完毕
button1.load('static/suo1.png', () =&amp;gt; {
    //创建view
    this.suo1 = new plus.nativeObj.View('suo1', { top: this.screenWidth / 2 - 32 + 'px', left: '40px', height: '54px', width: '54px', backgroundColor: 'transparent' });
    //圆形半透明背景
    this.suo1.drawRect({ color: 'rgba(0,0,0,0.2)', radius: '27px' }, { top: '0px', left: '0px', width: '100%', height: '100%' });
    //画锁图片
    this.suo1.drawBitmap(button1, { top: '0px', left: '0px', width: '100%', height: '100%' }, { top: 'auto', left: 'auto', width: '50%', height: '50%' });
    this.suo1.hide('auto', 0);
    this.suo1.addEventListener(
        'click',
        () =&amp;gt; {
    
        },
        false
    );
});
&lt;/code&gt;&lt;/pre&gt;
&lt;/body&gt;</description><pubDate>Tue, 05 May 2020 10:24:00 +0800</pubDate></item><item><title>uniapp内使用nvue做原生标题</title><link>https://pdfh5.gjtool.cn/?id=23</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;nvue页面只能使用vue的生命周期，uniapp生命周期api支持部分，css样式只支持flex，很多css样式不支持&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;template&amp;gt;
    &amp;lt;div class=&quot;controls-top&quot; ref=&quot;controlsTop&quot;&amp;gt;
        &amp;lt;div class=&quot;title&quot;&amp;gt;&amp;lt;text class=&quot;text&quot;&amp;gt;{{title}}&amp;lt;/text&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class=&quot;fanhui&quot; @tap=&quot;back&quot;&amp;gt;&amp;lt;text class=&quot;ios-icon&quot;&amp;gt;&amp;lt;/text&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class=&quot;top-right1&quot;&amp;gt;
            &amp;lt;div class=&quot;power-view&quot;&amp;gt;
                &amp;lt;div class=&quot;power-box&quot;&amp;gt;
                    &amp;lt;div class=&quot;power-header&quot;&amp;gt;&amp;lt;/div&amp;gt;
                    &amp;lt;div class=&quot;power-body&quot;&amp;gt;&amp;lt;div class=&quot;power-level&quot; :style=&quot;{ width: `${16 * level}px`, backgroundColor: '#fff' }&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class=&quot;top-right2&quot;&amp;gt;
            &amp;lt;text class=&quot;ios-sm-title&quot;&amp;gt;{{nowTime}}&amp;lt;/text&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
const animation = weex.requireModule('animation');
const modal = weex.requireModule('modal');
export default {
    data() {
        return {
            level:0,
            nowTime:&quot;00:00&quot;,
            title:'',
            timer:null,
            platform:null
        }
    },
    beforeCreate() {
        // #ifdef APP-PLUS-NVUE
        var domModule = weex.requireModule('dom');
        domModule.addRule('fontFace', {
            fontFamily: 'texticons',
            src: &quot;url('../../../static/text-icon.ttf')&quot;
        });
        // #endif
    },
    created(){
        uni.getSystemInfo({
            success: (e) =&amp;gt; {
                // #ifndef MP
                this.platform = e.platform
                // #endif
            }
        })
    },
    mounted() {
        this.getLevel()
        this.timer = setInterval(()=&amp;gt;{
            this.nowTime = this.getNowTime()
        },1000)
        uni.$on(&quot;videoTitileShow&quot;,()=&amp;gt;{
            this.nowTime = this.getNowTime()
            this.animateControls(0,this.$refs.controlsTop)
        })
        uni.$on(&quot;videoTitileHide&quot;,()=&amp;gt;{
            this.animateControls(-40,this.$refs.controlsTop)
        })
        uni.$on(&quot;videoTitileChange&quot;,(title)=&amp;gt;{
            this.title = title
        })
    },
    destroyed() {
        uni.$off(&quot;videoTitileShow&quot;)
        uni.$off(&quot;videoTitileHide&quot;)
        uni.$off(&quot;videoTitileChange&quot;)
        clearInterval(this.timer)
    },
    methods: {
        getLevel(){
            let promise = new Promise((resolve,reject)=&amp;gt;{
                //#ifdef APP-PLUS-NVUE
                if(this.platform == 'android'){
                    //注意，安卓需要配置下manifest.json文件，打开后，进入模块权限配置，在右侧的Android权限设置里勾选上android.permission.BATTERY_STATS
                    var main = plus.android.runtimeMainActivity();  
                    var Intent = plus.android.importClass('android.content.Intent');  
                    var recevier = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {  
                            onReceive: function(context, intent) {  
                            var action = intent.getAction();  
                            if (action == Intent.ACTION_BATTERY_CHANGED) {  
                                let level   = intent.getIntExtra(&quot;level&quot;, 0); //电量  
                                var voltage = intent.getIntExtra(&quot;voltage&quot;, 0); //电池电压  
                                var temperature = intent.getIntExtra(&quot;temperature&quot;, 0); //电池温度  
                                resolve(level/100)
                            }  
                         }  
                     });  
                    var IntentFilter = plus.android.importClass('android.content.IntentFilter');  
                    var filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);  
                    main.registerReceiver(recevier, filter);
                }else if(this.platform == 'ios'){
                    var UIDevice = plus.ios.import(&quot;UIDevice&quot;);
                    var dev = UIDevice.currentDevice();  
                    if (!dev.isBatteryMonitoringEnabled()) {  
                        dev.setBatteryMonitoringEnabled(true);  
                    }  
                    let level =dev.batteryLevel();  
                
                    resolve(level)
                }
                //#endif
                //#ifdef MP-WEIXIN
                wx.getBatteryInfo({
                    success: function(e) {
                        resolve(e.level)
                    }
                })
                //#endif
            })
            promise.then(res=&amp;gt;{
                this.level = res
            })
        },
        getNowTime(){
            var now = new Date();
            var hh = now.getHours();            //时
            if(hh&amp;lt;10) hh = &quot;0&quot; + hh;
            var mm = now.getMinutes();          //分
            if(mm&amp;lt;10) mm = &quot;0&quot; + mm;  
            return `${hh}:${mm}`; 
        },
        back(){
            this.animateControls(-40,this.$refs.controlsTop)
            uni.$emit(&quot;exitFullscreen&quot;)
        },
        animateControls(distance,el){
            animation.transition(el, {
                styles: {
                    transform: `translate(0px, ${distance}px)`,
                },
                duration: 350, //ms
                timingFunction: 'ease',
                delay: 0 //ms
                }, () =&amp;gt; {
                
                }
            )
        }
    }
};
&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;
.controls-top {
    /* width: 750upx; */
    /* #ifndef APP-PLUS-NVUE */
    display: flex;
    /* #endif */
    position: relative;
    background-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
    height: 40px;
    transform: translateY(-40px);
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 0 40px 0 40px;
}
.ios-icon {
    font-size: 18px;
    color: #fff;
    font-family: texticons;
}
.title {
    /* width: 750upx; */
    height: 40px;
    /* #ifndef APP-PLUS-NVUE */
    display: flex;
    /* #endif */
    position: absolute;
    left: 40px;
    right: 80px;
    top: 0px;
    justify-content: center;
    text-align: left;
    align-items: flex-start;
    /* background-color: #007aff; */
    padding: 0 10px 0 10px;
}
.text {
    color: #fff;
    font-size: 14px;
}
.fanhui {
    /* #ifndef APP-PLUS-NVUE */
    display: flex;
    /* #endif */
    width: 40px;
    height: 40px;
    position: absolute;
    top: 0;
    left: 0;
    justify-content: center;
    align-items: center;
}
.top-right1 {
    /* #ifndef APP-PLUS-NVUE */
    display: flex;
    /* #endif */
    align-items: center;
    font-size: 12px;
    color: #fff;
    position: absolute;
    top: 14px;
    right: 2px;
    width: 40px;
}
.top-right2 {
    /* #ifndef APP-PLUS-NVUE */
    display: flex;
    /* #endif */
    align-items: center;
    font-size: 12px;
    color: #fff;
    position: absolute;
    top: 12px;
    right:38px;
    width: 40px;
}
.power-view {
    /* #ifndef APP-PLUS-NVUE */
    display: flex;
    /* #endif */
    align-items: center;
}
.power-box {
    flex-direction: row;
    align-items: center;
}
.power-header {
    height: 4px;
    width: 2px;
    background-color: #fff;
}
.power-body {
    height: 9px;
    width: 20px;
    border-width: 1px;
    border-color: #fff;
    padding: 1px;
    flex-direction: row;
    justify-content: flex-end;
}
.power-level {
    height: 5px;
}
.ios-sm-title{
    font-size: 10px;
    color: #fff;
}
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;image.png&quot; alt=&quot;null&quot; src=&quot;https://img.hacpai.com/file/2020/01/image-31ebd16a.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;pages.josn配置nvue&lt;br&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;image.png&quot; alt=&quot;null&quot; src=&quot;https://img.hacpai.com/file/2020/01/image-095f28fb.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;vue页面里获取nvue组件，使用&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;this.videoTitleNvue = uni.getSubNVueById('title');
this.videoTitleNvue.setStyle({
    top: 44 + uni.getSystemInfoSync().statusBarHeight + 'px',
    left: '0px',
    width: '100%',
    height: '40px'
});
this.videoTitleNvue.show('auto', 0, function() {
    // 打开后进行一些操作...
    //
});
```uniapp 内使用 nvue 做原生标题
&lt;/code&gt;&lt;/pre&gt;
&lt;/body&gt;</description><pubDate>Fri, 17 Apr 2020 10:22:06 +0800</pubDate></item><item><title>uniapp安卓应用输入法软键盘弹起窗口顶起变形解决办法</title><link>https://pdfh5.gjtool.cn/?id=20</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;pre&gt;&lt;code&gt;&quot;app-plus&quot;: {
    &quot;softinputMode&quot;: &quot;adjustResize&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;softinputMode：软键盘弹起模式，有两个值：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;adjustResize：软键盘弹出时，webview窗体高度挤压。屏幕高度=webview窗体高度+软键盘高度&lt;/li&gt;&lt;li&gt;adjustPan：软键盘弹出时，webview窗体高度不变，但窗体上推，以保证输入框不被软键盘盖住&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;softinputMode默认值为adjustPan。&lt;/p&gt;
&lt;p&gt;uniapp安卓应用，输入法软键盘弹起的时候，默认是窗口顶起，页面遭受挤压。这个在登录注册等业务场景下没有问题，但是在论坛聊天业务下就不行了。&lt;/p&gt;
&lt;p&gt;这个时候需要在pages.json配置下，在你需要配置的页面下配置”app-plus”：{“softinputMode”: “adjustResize”}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;还有几个相关的常用：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;input组件 &lt;a class=&quot;at-link&quot; title=&quot;@focus&quot; href=&quot;https://github.com/focus&quot;&gt;@focus&lt;/a&gt;事件，可以获取到当前弹起的输入法软键盘高度：&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;methods:{
    focus(e){  
     let height = e.detail.height  
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;获取当前窗体高度&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;onLoad() {  
          let screenHeight = uni.getSystemInfoSync().windowHeight;  
        }
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;获取当前屏幕状态栏高度&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;onLoad() {  
          let statusHeight= uni.getSystemInfoSync().statusBarHeight;  
        }
&lt;/code&gt;&lt;/pre&gt;
&lt;/body&gt;</description><pubDate>Wed, 25 Mar 2020 10:23:43 +0800</pubDate></item><item><title>uniapp系统通知权限判断android6.0和IOS</title><link>https://pdfh5.gjtool.cn/?id=25</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;android6.0+&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var main = plus.android.runtimeMainActivity();  
var pkName = main.getPackageName();  
var NotificationManagerCompat = plus.android.importClass(&quot;android.support.v4.app.NotificationManagerCompat&quot;);  
var packageNames = NotificationManagerCompat.from(main);  
console.log(JSON.stringify(packageNames));  
if (packageNames.areNotificationsEnabled()) {  
    console.log('已开启通知权限');  
}else{  
    uni.showModal({  
        title: '提示',  
        content: '请先打开APP通知权限',  
        showCancel: false,  
        success: function (res) {  
            if (res.confirm) {  
                var Intent = plus.android.importClass('android.content.Intent');  
                var intent = new Intent('android.settings.APP_NOTIFICATION_SETTINGS');//可设置表中所有Action字段  
                intent.putExtra('android.provider.extra.APP_PACKAGE', pkName);  
                main.startActivity(intent);  
            }  
        }  
    });  
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;IOS&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var UIApplication = plus.ios.import(&quot;UIApplication&quot;);  
var app = UIApplication.sharedApplication();  
var enabledTypes  = 0;  
if (app.currentUserNotificationSettings) {  
    var settings = app.currentUserNotificationSettings();  
    enabledTypes = settings.plusGetAttribute(&quot;types&quot;);  
} else {  
    //针对低版本ios系统  
    enabledTypes = app.enabledRemoteNotificationTypes();  
}  
plus.ios.deleteObject(app);  
if ( 0 == enabledTypes ) {  
    uni.showModal({  
        title: '提示',  
        content: '请先打开APP通知权限',  
        showCancel: false,  
        success: function (res) {  
            if (res.confirm) {  
                var UIApplication = plus.ios.import(&quot;UIApplication&quot;);  
                var NSURL = plus.ios.import(&quot;NSURL&quot;);  
                var setting = NSURL.URLWithString(&quot;app-settings:&quot;);  
                var application = UIApplication.sharedApplication();  
                application.openURL(setting);  
                plus.ios.deleteObject(setting);  
                plus.ios.deleteObject(application);  
            }  
        }  
    });  
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/body&gt;</description><pubDate>Fri, 21 Feb 2020 10:21:24 +0800</pubDate></item><item><title>uniapp安卓离线打包配置官方插件原生插件</title><link>https://pdfh5.gjtool.cn/?id=19</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;参考文档：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://ask.dcloud.net.cn/article/35416&quot;&gt;uni-app原生插件开发教程Android Studio 版&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://ask.dcloud.net.cn/article/35763&quot;&gt;uni-app原生插件集成指南&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;最好先看看我之前的一篇，打下基础：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gjtool.cn/articles/2020/04/30/1588237205184.html&quot;&gt;uniapp、5+app 安卓离线打包（多图，慎入）&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-1u3001u5148u4E0Bu597Du5B98u65B95+SDK-10&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;1、先下好官方5+SDK&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;1、先下好官方5+SDK&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;2.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMi01OTNiM2E4ZS5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-2u3001u6587u4EF6u5BF9u5E94u4F5Cu7528-14&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;2、文件对应作用&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;2、文件对应作用&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;1.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMS01MTczMTAyNC5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-3u3001u6253u5F00Anadroid20Studiou5BFCu5165uniappu793Au4F8Bu5DE5u7A0B-18&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;3、打开Anadroid Studio导入uniapp示例工程&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;3、打开Anadroid Studio导入uniapp示例工程&lt;/h2&gt;&lt;h2 id=&quot;h2-4u3001u70B9u51FBProjectu548CAnadroidu53EFu4EE5u5207u6362u76EEu5F55u89C6u56FE-20&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;4、点击Project和Anadroid可以切换目录视图&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;4、点击Project和Anadroid可以切换目录视图&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;4.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvNC0wODIzMjdiYS5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-5u3001u8FD9u4E09u4E2Au7EA2u6846uFF0Cu662Fu63D2u4EF6u5173u952Eu6587u4EF6uFF0Cu540Eu9762u4E3Bu8981u6539u7684u5C31u662Fu5B83u4EEC-24&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;5、这三个红框，是插件关键文件，后面主要改的就是它们&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;5、这三个红框，是插件关键文件，后面主要改的就是它们&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;0.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMC0zZGI4YTJkMi5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-6u3001u9996u5148u5220u9664u65E0u7528u4F9Du8D56uFF0Cu8FD9u4E2Au662Fu793Au4F8Bu7684u4E00u4E2Au63D2u4EF6uFF0Cu6211u4EECu4E0Du9700u8981-28&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;6、首先删除无用依赖，这个是示例的一个插件，我们不需要&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;6、首先删除无用依赖，这个是示例的一个插件，我们不需要&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;3.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMy05MTY3ZDUzNS5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-7u3001u6309u4E0Bu56FEu6240u793AuFF0Cu4FEEu6539appiduFF0Cappidu5728hbuilderXu7684u9879u76EEu5DE5u7A0Bu6587u4EF6u91CCuFF0Cmanifest.jsonu6E90u7801u89C6u56FEu91CCu53EFu4EE5u62FFu5230-32&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;7、按下图所示，修改appid，appid在hbuilderX的项目工程文件里，manifest.json源码视图里可以拿到&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;7、按下图所示，修改appid，appid在hbuilderX的项目工程文件里，manifest.json源码视图里可以拿到&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;5.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvNS1lOTU4NWIzNi5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;用hbuilderX把工程生成离线文件，然后替换上图的www文件夹（删除替换）&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-8u3001u4FEEu6539u5305u540DuFF0Cu683Cu5F0Fu662Fxxx.xxx.xxxu4F8Bu5982com.test.test-38&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;8、修改包名，格式是xxx.xxx.xxx例如com.test.test&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;8、修改包名，格式是xxx.xxx.xxx例如com.test.test&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;6.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvNi02ZmZiYTdiNC5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;7.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvNy0wMjUwNzkxNC5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;按上图所示，修改两个文件的包名，修改完毕，点击下图所示红框部分&lt;br&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;8.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvOC1iNWMwYzkyZC5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-9u3001u67E5u770Bu9879u76EEu5DE5u7A0Bu6240u9700u6743u9650uFF0Cu5728Anadroid20Studiou914Du7F6Eu5BF9u5E94u6743u9650-48&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;9、查看项目工程所需权限，在Anadroid Studio配置对应权限&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;9、查看项目工程所需权限，在Anadroid Studio配置对应权限&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;9.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvOS1hYmJkMTgyMy5wbmc?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;打开权限excel表格查看，按需修改&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;10.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTAtMzViMDBhZGQucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;11.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTEtMzk3ZDA3MGQucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;12.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTItNmMwZTYzODgucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;按需复制sdk&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;13.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTMtODE2YmJiMTkucG5n?x-oss-process=image/format,png&quot;&gt;&lt;br&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;14.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTQtNzFlZDRiOWEucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;填写对应的插件appid，key等&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;15.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTUtYzEwZGMwMTkucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在AndroidManifest.xml文件里配置权限&lt;/li&gt;&lt;li&gt;jar包，arr包放到libs文件夹&lt;/li&gt;&lt;li&gt;开放给js层的方法名，在dcloud_properties.xml文件里配置&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;17.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTctN2E4ZTE2ODMucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;18.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTgtMWZhZjkxODMucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-10u3001u539Fu751Fu63D2u4EF6uFF0Cu5B98u65B9u63D2u4EF6uFF0Cu6253u5F00hbuilderXuFF0Cu67E5u770Bu5DE5u7A0Bu76EEu5F55nativepluginsu91CCu5B89u5353u90E8u5206-78&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;10、原生插件，官方插件，打开hbuilderX，查看工程目录nativeplugins里安卓部分&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;10、原生插件，官方插件，打开hbuilderX，查看工程目录nativeplugins里安卓部分&lt;/h2&gt;&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;16.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTYtMmI5ZTVhYzkucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;jar包，arr包放到libs文件夹&lt;/li&gt;&lt;li&gt;android文件夹下的packge.json,红框部分直接复制到 dcloud_uniplugins.json&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-11u3001u4E0Bu8F7Du5B98u65B9u516Cu7528u6D4Bu8BD5u7248u7B7Eu540D-86&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;11、下载官方公用测试版签名&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;11、下载官方公用测试版签名&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://ask.dcloud.net.cn/article/36522&quot;&gt;https://ask.dcloud.net.cn/article/36522&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;19.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMTktODlmZmZiNDUucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-12u3001u586Bu5199u7B7Eu540DuFF0Cu81EAu52A8u6253u5305u7B7Eu540Du3002-92&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;12、填写签名，自动打包签名。&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;12、填写签名，自动打包签名。&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;发布正式版的时候，就新建一个release，自己生成一个新签名。然后按下面步骤添加，打包正式版自动签名&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;20.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMjAtMjg4ZmIxNGEucG5n?x-oss-process=image/format,png&quot;&gt;&lt;br&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;21.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMjEtMGM5NTcwNDYucG5n?x-oss-process=image/format,png&quot;&gt;&lt;br&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;22.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMjItYmRhOTUxN2YucG5n?x-oss-process=image/format,png&quot;&gt;&lt;br&gt;&lt;img style=&quot;max-width:100%;&quot; title=&quot;23.png&quot; alt=&quot;null&quot; src=&quot;https://imgconvert.csdnimg.cn/aHR0cHM6Ly9pbWcuaGFjcGFpLmNvbS9maWxlLzIwMTkvMTEvMjMtZTg1ZWU2NmMucG5n?x-oss-process=image/format,png&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;完成以上步骤后，点击ok等它跑完，就可以打包的时候自动签名了&lt;/li&gt;&lt;li&gt;参考文档：&lt;a href=&quot;https://blog.csdn.net/bxllove/article/details/79742480&quot;&gt;https://blog.csdn.net/bxllove/article/details/79742480&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;h2-13u3001u81EAu5B9Au4E49u7B2Cu4E09u65B9u539Fu751Fu63D2u4EF6u5F85u7EEDu2026u2026-103&quot;&gt;&lt;a class=&quot;reference-link&quot; name=&quot;13、自定义第三方原生插件待续……&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;13、自定义第三方原生插件待续……&lt;/h2&gt;&lt;/body&gt;</description><pubDate>Fri, 24 Jan 2020 10:19:44 +0800</pubDate></item><item><title>uniapp动态修改原生标题栏按钮webview样式等</title><link>https://pdfh5.gjtool.cn/?id=21</link><description>&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;pre&gt;&lt;code&gt;// #ifdef APP-PLUS
var currentWebview = this.$mp.page.$getAppWebview();
var tn = currentWebview.getStyle().titleNView;
tn.buttons[1].text = this.cancelFlag ? &quot;完成&quot;:&quot;编辑&quot;;
currentWebview.setStyle({
titleNView: tn
});
// #endif
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;原生view的样式参考&lt;a href=&quot;http://www.html5plus.org/doc/zh_cn/nativeobj.html#plus.nativeObj.ViewStyles&quot;&gt;http://www.html5plus.org/doc/zh_cn/nativeobj.html#plus.nativeObj.ViewStyles&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;this.currentWebview = this.$mp.page.$getAppWebview();
this.titleNView = this.currentWebview.getTitleNView();
let currentWebview = plus.webview.currentWebview(); //获取当前页面的webview对象
this.currentWebview = currentWebview;
// this.webview = currentWebview.children()[0];
this.webview = plus.webview.create('/hybrid/html/index.html?app=true', 'custom-webview', {
top: 0 ,//放置在titleNView下方。如果还想在webview上方加个地址栏的什么的，可以继续降低TOP值
cachemode:&quot;cacheElseNetwork&quot;,//只要存在缓存（即使过期）数据则使用，否则从网络获取
hardwareAccelerated:true,//开启硬件加速
kernel:&quot;WKWebview&quot;,//使用WKWebview内核
popGesture:&quot;none&quot;
});
this.currentWebview.append(this.webview);

let currentWebview = plus.webview.currentWebview(); //获取当前页面的webview对象
this.currentWebview = currentWebview;
// this.webview = currentWebview.children()[0];
this.webview = plus.webview.create('/hybrid/html/index.html?app=true', 'custom-webview', {
top: 0 ,//放置在titleNView下方。如果还想在webview上方加个地址栏的什么的，可以继续降低TOP值
cachemode:&quot;cacheElseNetwork&quot;,//只要存在缓存（即使过期）数据则使用，否则从网络获取
hardwareAccelerated:true,//开启硬件加速
kernel:&quot;WKWebview&quot;,//使用WKWebview内核
popGesture:&quot;none&quot;
});
this.currentWebview.append(this.webview);
&lt;/code&gt;&lt;/pre&gt;
&lt;/body&gt;</description><pubDate>Fri, 15 Nov 2019 10:18:23 +0800</pubDate></item></channel></rss>