import Vue from 'vue'
import Element from 'element-ui'
Vue.use(Element)
//重点:下面这句代码必须要写到Vue.use(Element)下面,否则还会继续报错
Vue.prototype.$confirm = Element.MessageBox.confirm
this.$confirm is not a function今天在做项目的时候发在使用$confirm方法的时候总是会报错查了好多文章都是说因为没有引入MessageBox模块,但是我是全局引入的,于是在多方尝试下,在main.js中定义:import Vue from 'vue'import Element from 'element-ui'Vue.use(Element)//重点:下面这句代码必须要写到Vue.use(Element)下面,否则还会继续报错Vue.prototype.