Ant文檔只提供給我們一些在頁(yè)面中使用模態(tài)框和信息框的使用,并沒(méi)有提供js的使用方式,使用下述方法可以直接使用這些彈窗:
在main.js全局引用:
import Modal from 'ant-design-vue/lib/modal/index' //引入模態(tài)
Vue.prototype.$modal = Modal;
使用方法:
this.$modal.confirm({title:'溫馨提示',content:'您確定要?jiǎng)h除本條信息嗎?',okText:'確定',cancelText:'取消',
onOk:()=>{
},
onCancel:()=>{
}});
消息框使用:
this.$message.info('你好');
this.$message.error('你好');
this.$message.info('你好');
this.$message.warn('你好');
this.$message.loading('你好');