1.全局注册
import { Dialog } from 'vant';
// 全局注册
Vue.use(Dialog);
<button @click=addgoods() > </button>
2.确认取消框的使用
methods:{
addgoods(){
this.$dialog.confirm({
title: '温馨提示', //标题设置
message: '此时需要先登录才能操作哦',//主体内容设置
confirmButtonText: '确认购买', // 确认按钮文本设置
cancelButtonText: '再逛逛'// 取消按钮文本设置
})
.then(() => {
//确认处理
})
.catch(() => {
//取消处理
})
}
}