How to use the components of vue in js

use the iview framework in the project. Now you want to do a prompt component for form validation, but you want to be able to use it in js. Message similar to iview

this.$Message.warn("....")

how to introduce components if you want to use them in this way.


const Message = Vue.extend(component)
const message = new Message().$mount() // body

Mount to the global @ lady plugin to learn about
Vue.prototype.$message = message


does not understand what your use in js means. If you want to use it in non-vue components, you can mount your js object to the vue instance


ide/plugins.html-sharp%E5%BC%80%E5%8F%91%E6%8F%92%E4%BB%B6" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.

plug-ins to learn about

Menu