以下是个人整理的MUI框架常用代码段,仅供个人记录。
---------------------------------------------------------------------------------------
//双击标题返回顶部
mui.init({
gestureConfig:{
tap: true, //默认为true
doubletap: true
}
});
//单页面
mui('.mui-bar-nav').on('doubletap','.mui-title',function(){
window.scrollTo(0, 0);
});
//包含子页面的方式-能直接获取子页面
mui('.mui-bar-nav').on('doubletap','.mui-title',function(){
var contentWebview = plus.webview.getWebviewById('index_sub');
//内容区滚动到顶部
contentWebview.evalJS("mui('#refreshContainer').pullRefresh().scrollTo(0,0,200)");
});
//包含子页面的方式-不能直接获取子页面
var contentWebview = null;
mui('.mui-bar-nav').on('doubletap','.mui-title',function(){
if(contentWebview==null){
contentWebview = plus.webview.currentWebview().children()[0];
}
//内容区滚动到顶部
contentWebview.evalJS("mui('#refreshContainer').pullRefresh().scrollTo(0,0,200)");
});
---------------------------------------------------------------------------------------
//获取当前webview
var self = plus.webview.currentWebview();
//根据id查找webview
var webview = plus.webview.getWebviewById('id');
---------------------------------------------------------------------------------------
//发送数据 webview,事件名称,{}格式数据
mui.fire(webview_page, 'get_detail', data);
//接收跳转查询参数
window.addEventListener('get_detail',function(e){
e.detail.key;
e.detail.value;
});
---------------------------------------------------------------------------------------
//创建原生窗口
var webviewStyle = {
titleNView: {
autoBackButton: true,
backgroundColor: '#007aff',
titleColor: '#FFFFFF',
titleText: ''
},
scrollIndicator: 'none',
scalable: false
};
//plus.webview.create() url,id,style,传参
var detail_page = plus.webview.create("sfdPro_detail.html", "sfdPro_detail",webviewStyle,param);
//接收参数
mui.plusReady(function(){
var self = plus.webview.currentWebview();
self.key;
self.value;
});
----------------------------------------------------------------------------------------
//VUE数据绑定
var detail_List = new Vue({
el:'#main_content',
data:{rows:[]},
methods:{
resetData : function (){
mui.extend(this.$data, {rows:[]});
}
}
});
-----------------------------------------------------------------------------------------
<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-3"></div>