Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.16 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.16 KB

动态挂载 vue 组件

Installtion

npm i use-dynamic-mount

Usage

import Vue from 'vue'
import useDynamicMount from 'use-dynamic-mount'

Vue.use(useDynamicMount(), {
  name: '$toast',
  extend: {
    data: () => ({ message: '' }),
    render(h) {
      return h('span', this.message)
    }
  }
})

this.$toast({ message: 'hello world' })

Options

参数名 说明 类型 默认值
name 方法名 String $dynamicMount
extend 挂载的组件 (必填) VNode -
nextTick 挂载后的回调 Function -
className 挂载节点自定义 class String dynamic-element
defaultOption extend 组件默认配置 Record<string, any> {}

Example

Edit keen-butterfly-f1ml2l