在 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
});

微信小程序使用 vant Dialog组件

相关文章:

  • 2021-09-02
  • 2022-01-14
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-31
  • 2021-12-07
  • 2021-04-01
  • 2021-08-18
  • 2021-06-01
  • 2021-12-05
相关资源
相似解决方案