提前渲染 mip 元素。
如果元素不在 viewport 内,强制触发元素的 viewportCallback firstInviewCallback 方法。
|
varelement =document.getElementById('mip-test'); MIP.prerenderElement(element); |
由于mip不允许使用附加的JS代码。所以提供了一套事件action机制,可以通过dom属性来触发某个mip元素的自定义事件。
html:
|
不带参数 带参数 多个事件 |
JS:
|
// mip-test.js define(function(require){ var customEle =require('cust omElement').create(); customEle.prototype.build =function(){ // 绑定事件,其它元素可通过 on="xxx" 触发 this.addEventAction("custom_event",function(event/* 对应的事件对象 */, str/* 事件参数 */){ console.log(str);// undefined or 'test_button' or 'test_button1' }); }; returncustomEle; }); |
virtualbox打不开虚拟机怎么办? linux无法访问virtualbox的解决办法
deepin怎么注销系统? deepin系统注销与切换用户的方法
Manjaro linux怎么调鼠标速度? Manjaro鼠标设置光标速度的技巧
Kali Linux鼠标光主题怎么修改? 修改鼠标光标主题的技巧
deepin系统版本号怎么看? deepin系统查看系统版本信息的技巧
Linux网卡无法启动报错RTNETLINK answers File exists怎么办?