variant-form/install.js

48 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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)
Vue.component('container-widget', ContainerWidget)
}
VFormRender.install = function (Vue) {
Vue.component(VFormRender.name, VFormRender)
Vue.component('container-item', ContainerItem)
}
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
}