1.问题描述
正常写this. c o n f i r m 或 者 V u e . confirm或者Vue. confirm或者Vue.confirm,可能会报错$confirm is not a function,这是由于Vue对象下并没有这个方法,查看Vue或者this对象,发现prototype对象下有很多方法,其中就包含 $confirm
2.输出对象
console.log(Vue.prototype)
console.log(this.prototype)
3.解决办法
其实看到prototype下的对象,大家应该就知道怎么调用了
Vue.prototype.$confirm()
//或者
this.prototype.$confirm()