variant-form/install.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-09-23 09:35:06 +00:00
import axios from 'axios'
import VFormDesigner from '@/components/form-designer/index.vue'
import VFormRender from '@/components/form-render/index.vue'
import ContainerWidget from "@/components/form-designer/form-widget/container-widget";
import ContainerItem from "@/components/form-render/container-item";
import '@/utils/directive'
import '@/icons'
import '@/iconfont/iconfont.css'
VFormDesigner.install = function (Vue) {
Vue.component(VFormDesigner.name, VFormDesigner)
2021-09-29 07:52:17 +00:00
Vue.component('container-widget', ContainerWidget)
2021-09-23 09:35:06 +00:00
}
VFormRender.install = function (Vue) {
Vue.component(VFormRender.name, VFormRender)
2021-09-29 07:52:17 +00:00
Vue.component('container-item', ContainerItem)
2021-09-23 09:35:06 +00:00
}
const components = [
VFormDesigner,
VFormRender
]
const install = (Vue) => {
/* 递归组件如需在递归组件的嵌套组件中使用,必须注册为全局组件,原因不明?? begin */
Vue.component('container-widget', ContainerWidget)
Vue.component('container-item', ContainerItem)
/* end */
components.forEach(component => {
Vue.component(component.name, component)
})
}
if (typeof window !== 'undefined' && window.Vue) { /* script方式引入时主动调用install方法 */
window.axios = axios
install(window.Vue);
}
export default {
install,
VFormDesigner,
VFormRender
}