About vue extend

// toast.vue
<template>
  <div class="fire-toast" v-show="visible">
    <p class="fire-toast-text">{{message}}

</div> </template>
// index.js 
import Vue from "vue"
const ToastContructor = Vue.extend(require("./src/Toast.vue"))

const Toast = content => {
  // 
  const ToastInstance = new ToastContructor({
    data: {
      content: content
    }
  })
  // dom
  ToastInstance.vm = ToastInstance.$mount()
  ToastInstance.vm.visible = true
  document.body.appendChild(ToastInstance.vm.$el)
  return ToastInstance.vm
}

export default Toast
// main.js
import Toast from "../packages/toast"
Vue.prototype.$toast = Toast

call this.$toast ("test") directly during use, and vue reports an error as shown in the following figure. What"s wrong with it?

clipboard.png

Mar.12,2021

found the reason. Where is https://codeshelper.com/q/10.


mounted? $mount ("- sharpapp")?

Menu