[Solved] Error in v-on handler: “TypeError: this.$confirm is not a function“

Error in v-on handler: “TypeError: this.$confirm is not a function“

In the Vue project, an error is reported after changing the global import of element UI to on-demand import

Solution:

1. Introduce MessageBox plug-in

import {MessageBox} from ‘element-ui’

2 mount confirm
on the prototype object of Vue

Vue.prototype.$confirm = MessageBox.confirm

Similar Posts: