微信小程序Dialog的使用

首先我们在json里引入

    "van-dialog": "@vant/weapp/dialog/index"

然后在js里引入(放在在Page上面)(这里需要写自己的路径)

import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';
然后在wxml里写入Dialog

```cpp
<!-- 弹框 -->
<van-dialog id="van-dialog" />
然后在onload或者方法里写入

```cpp
  Dialog.confirm({
      title: '取消订单',
      message: '确定取消订单吗?',
    })
      .then(() => {
        // on confirm
        
      })
      .catch(() => {
        // on cancel
      });

附带vant小程序的网址(Dialog):https://youzan.github.io/vant-weapp/#/dialog

猜你喜欢

转载自blog.csdn.net/wsxDream/article/details/112243082