Nary a Package Missing

    vue-mount-component-to-dom
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.1 • Public • Published

    vue-mount-component-to-dom

    1. mount vue component to dom

    2. add component instance to Vue.prototype, you can call functions directly in vue

    Usage

    mountComponent(
      _vue: Vue | VueConstructor<Vue>,
      protoName: string,
      vueCompConf: VueConstructor<Vue>,
      el: HTMLElement = document.body   // optional. default is document.body
    )

    Demo

    /**
     * file: main.js
     */
    import Vue from "vue"
    import { Toast } from "@/src/components/Toast/index.vue"
     
    import mountComponent from "vue-mount-component-to-dom"
    mountComponent(Vue, "$Toast", Toast)
     
    /**
     * file: somePage.vue
     */
    export default class SomePage extends Vue {
      showTip() {
        // you can call `this.$Toast` directly
        this.$Toast.show()
      }
    }

    License

    MIT

    Install

    npm i vue-mount-component-to-dom

    DownloadsWeekly Downloads

    8

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    4.75 kB

    Total Files

    6

    Last publish

    Collaborators

    • microj