How to use portal-vue - 2 common examples

To help you get started, we’ve selected a few portal-vue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bootstrap-vue / bootstrap-vue / src / components / toast / toaster.js View on Github external
beforeMount() {
    this.staticName = this.name
    /* istanbul ignore if */
    if (Wormhole.hasTarget(this.staticName)) {
      warn(
        `A "" with name "${this.name}" already exists in the document.`,
        'BToaster'
      )
      this.dead = true
    } else {
      this.doRender = true
      this.$once('hook:beforeDestroy', () => {
        // Let toasts made with `this.$bvToast.toast()` know that this toaster
        // is being destroyed and should should also destroy/hide themselves
        this.$root.$emit('bv::toaster::destroyed', this.staticName)
      })
    }
  },
  destroyed() {
github bootstrap-vue / bootstrap-vue / src / components / toast / toast.js View on Github external
ensureToaster() {
      if (this.static) {
        return
      }
      if (!Wormhole.hasTarget(this.computedToaster)) {
        const div = document.createElement('div')
        document.body.appendChild(div)
        const toaster = new BToaster({
          parent: this.$root,
          propsData: {
            name: this.computedToaster
          }
        })
        toaster.$mount(div)
      }
    },
    startDismissTimer() {

portal-vue

> A Portal Component for Vue 3, to render DOM outside of a component, anywhere in the document.

MIT
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis

Popular portal-vue functions