微信小程序使用 vant Dialog组件

在 app.json 或 index.json 中引入组件

"usingComponents": {
  "van-dialog": "path/to/vant-weapp/dist/dialog/index"
}

​

在xxx.wxml中写入


<van-dialog id="van-dialog" />
​

在xxx.js中引入

import Dialog from 'path/to/vant-weapp/dist/dialog/dialog';(记得路径写入你自己的路径)

当然如果你想立马看到效果,在onLoad中直接写入

Dialog.alert({
  title: '标题',
  message: '弹窗内容'
}).then(() => {
  // on close
});

猜你喜欢

转载自blog.csdn.net/weixin_41013537/article/details/86528528