@mosowe2/element-pro
Version:
element高级组件,封装element的常用组件
30 lines (29 loc) • 872 B
JavaScript
import editDiv from "./editDiv";
import proForm from "./proForm";
import proTable from "./proTable";
import Empty from "./Empty";
import Dialog from "./Dialog";
const components = [editDiv, proTable, proForm, Empty, Dialog]
const install = function (Vue, options = {}) {
// 判断是否安装
if (install.installed) return
components.forEach(item => {
if (item.name === 'Empty') {
item.props['tableEmptyText'].default = options?.tableEmptyText || '暂无数据'
item.props['tableEmptyImage'].default = options?.tableEmptyImage || ''
}
Vue.component(item.name, item)
})
}
// 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue)
}
export default {
install,
editDiv,
proTable,
proForm,
Empty,
Dialog
}