JSPM

vue-dynamic-mounting

0.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q10043F
    • License ISC

    Programmatically/Dynamically mount your Vue components anywhere in the DOM

    Package Exports

    • vue-dynamic-mounting
    • vue-dynamic-mounting/dist/index.es.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-dynamic-mounting) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Vue Dynamic Mounting

    Programmatically mount your component anywhere

    Installation

    pnpm add vue-dynamic-mounting
    # or
    npm i vue-dynamic-mounting
    # or
    yarn add vue-dynamic-mounting

    Usage

    In your <script> block

    import { useMounting } from 'vue-dynamic-mounting'
    
    const { mount, componentMounted } = useMounting()
    
    function openDialog() {
      const { unmount } = mount(Dialog, { content: 'HelloWorld', onClose: unmount }, '#dialog-teleport')
    }

    <template> block:

    <section>
      <button @click="openDialog">
        Open Dialog
      </button>
    
      <div id="dialog-teleport"></div>
    </section>