Dcloud初使用小记

来源:互联网 发布:php企业网站 编辑:程序博客网 时间:2024/06/06 06:30

1.mui 结合vue注意事项:

vue初始化放在最前面,否则当mui里使用到scroll时无法实现滚动,或者将

$('.mui-scroll-wrapper').scroll({indicators: true //是否显示滚动条});
其放在plus.plusReady()中

2.安卓中调出输入法会把窗口上顶造成浮动框上移解决方法

获取webview原高度>调出输入法触发onresize事件>获取weview高度>高度进行对比>判断是否调出输入法>隐藏浮动块

const oH=plus.android.invoke(plus.android.currentWebview(),'getHeight');const x=20; window.onresize=()=>{let oH2=plus.android.invoke(plus.android.currentWebview(),'getHeight');var zindex=oH>oH2+x?1:0; var main=plus.webview.currentWebview().parent(); mui.fire(main,'barHide',{zindex:zindex}); document.getElementsByClassName('mui-input-group')[1].style.display=zindex?'none':'block';  };


3 mui已对a标签进行处理,无法直接通过点击链接直接跳转页面

// 监听tap事件,解决 a标签 不能跳转页面问题

$('body').on('tap','a',function(){document.location.href=this.href;});


0 0