vue项目中在单独的js文件中使用element ui
例如要使用MessageBox组件
1.引入组件
import { MessageBox } from ‘element-ui’;
2.使用
MessageBox.confirm(“这是一个内容”,“这是一个标题”,{
distinguishCancelAndClose: true,
confirmButtonText: ‘确认’,
showClose:false,
showCancelButton:false
}).then(()=>{
// 点击确认按钮的回调
})
一般是在响应拦截器中使用,亲测有效