1. 在app.ison 中加入 useExtendedLib 字段
"useExtendedLib": {
"weui": true
}
2. 在所需要的页面的 json 文件中 加入 usingComponents 字段
{
"usingComponents": {
"mp-dialog": "weui-miniprogram/dialog/dialog"
}
}
3. 组件的使用 wxml加入
<mp-dialog title="test" show="{{showDailog}}" bindbuttontap="tapDialogButton" buttons="{{[{text: '取消'}, {text: '确认'}]}}">
<view>test content</view>
</mp-dialog>
js文件加入
data: {
showDailog: true,
},
tapDialogButton(e) {
this.setData({
showDailog: false
})
},
像这样就可以正常使用WeUI的组件了!