Skip to content

vue-mount-pluginVue 组件挂载,简单易用

一个简单易用的 Vue 实例扩展插件,支持 Vue 2.0 和 Vue 3.0

vue-mount-plugin

快速开始

安装

bash
# pnpm
pnpm add vue-mount-plugin

# npm
npm install vue-mount-plugin

# yarn
yarn add vue-mount-plugin

使用

typescript
import { mount } from 'vue-mount-plugin'
import Modal from './Modal.vue'

// 挂载并立即显示
const instance = mount(Modal, {
  props: { title: 'Hello World' }
})

// 完成后卸载
instance.unmount()

为什么选择 vue-mount-plugin?

  • 无样板代码:无需手动管理 DOM 元素和 Vue 实例
  • 灵活控制:精细控制组件生命周期
  • 上下文继承:Vue 3 中正确继承上下文(router、pinia、i18n)
  • 自动清理:通过 useMount 组合式函数自动清理
  • 轻量级:体积小,支持 tree-shaking

基于 MIT 许可发布