vue-simple-portal

1.0.3 • Public • Published

vue-simple-portal

NPM version NPM downloads CircleCI

Simple portal component which allows to mount component anywhere.

Just like portal-vue but does less.

Install

yarn add vue-simple-portal

CDN: UNPKG | jsDelivr (available as window.SimplePortal)

Usage

Given an html file:

<!-- where your app is mounted -->
<div id="app"></div>
<!-- where the portal targets are mounted -->
<div id="target"></div>

And your component:

<template>
  <simple-portal target="target">
    <h1>haha</h1>
    <h2>it just works<h1>
    <p>we'll appear in #target element!</p>
  </simple-portal>
</template>
 
<script>
import SimplePortal from 'vue-simple-portal'
 
export default {
  components: {
    SimplePortal
  }
}
</script>

Props

target

Type: string
Required: true

The id of target HTML element.

componentName

Type: string
Default: portal-target

The component name for the portal target component.

It's recommended to set a custom name if you used this component for multiple times.

License

MIT © EGOIST

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.3135latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.3135
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i vue-simple-portal

Weekly Downloads

135

Version

1.0.3

License

MIT

Last publish

Collaborators

  • rem