vue3-gyc-ui
Version:
``` npm install vue3-gyc-ui ```
25 lines (24 loc) • 692 B
JavaScript
import gAddForm from "./components/g-add-form.vue"
import gTable from "./components/g-table.vue"
import "@/assets/main.css";
import "@/assets/icon.css";
const components = [
gAddForm, gTable
]
// 定义 install 方法
const install = function (Vue) {
if (install.installed) return
install.installed = true
// 遍历并注册全局组件
components.forEach(component => Vue.component(component.name, component))
}
// 全局引用可自动安装
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue)
}
export default {
// 导出的对象必须具备一个 install 方法
install,
// 组件列表
...components
}