微信小程式Dialog的使用
阿新 • • 發佈:2021-01-06
首先我們在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