1. 程式人生 > 其它 >微信小程式Dialog的使用

微信小程式Dialog的使用

技術標籤:小程式小程式

首先我們在json裡引入

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

然後在js裡引入(放在在Page上面)(這裡需要寫自己的路徑)

import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';

然後再onload或者方法裡寫入

  Dialog.confirm({
      title: '取消訂單',
      message: '確定取消訂單嗎?',
    })
      .then(() =>
{ // on confirm }) .catch(() => { // on cancel });

附帶vant小程式的網址(Dialog):https://youzan.github.io/vant-weapp/#/dialog