SvgIcon组件取消全局注册,改为局部注册。

This commit is contained in:
vdpAdmin 2022-10-21 13:45:46 +08:00
parent 38fe46c3f1
commit 7982a55ac4
18 changed files with 45 additions and 13 deletions

View File

@ -9,7 +9,7 @@
[在线Demo](http://120.92.142.115:81/vform3/) [在线Demo](http://120.92.142.115:81/vform3/)
### 立即体验VForm 3 Pro高级版提供商业支持 ### 立即体验VForm 3 Pro高级版提供商业支持
[VForm 3 Pro Demo](http://120.92.142.115:81/vform3pro/) [VForm 3 Pro Demo](https://vform666.com/pages/pro/)
### 适合Vue 2的版本看这里 ### 适合Vue 2的版本看这里
[点此查看](https://gitee.com/vdpadmin/variant-form) [点此查看](https://gitee.com/vdpadmin/variant-form)

View File

@ -4,7 +4,6 @@ import VFormRender from '@/components/form-render/index.vue'
import ContainerItems from '@/components/form-render/container-item/index' import ContainerItems from '@/components/form-render/container-item/index'
import {registerIcon} from '@/utils/el-icons' import {registerIcon} from '@/utils/el-icons'
import SvgIcon from '@/components/svg-icon' //svg组件
import 'virtual:svg-icons-register' import 'virtual:svg-icons-register'
import '@/iconfont/iconfont.css' import '@/iconfont/iconfont.css'
@ -17,7 +16,6 @@ VFormRender.install = function (app) {
app.use(ContainerItems) app.use(ContainerItems)
registerIcon(app) registerIcon(app)
app.component('svg-icon', SvgIcon)
app.component(VFormRender.name, VFormRender) app.component(VFormRender.name, VFormRender)
} }
@ -31,7 +29,6 @@ const install = (app) => {
app.use(ContainerItems) app.use(ContainerItems)
registerIcon(app) registerIcon(app)
app.component('svg-icon', SvgIcon)
components.forEach(component => { components.forEach(component => {
app.component(component.name, component) app.component(component.name, component)
}) })

View File

@ -5,7 +5,6 @@ import VFormRender from '@/components/form-render/index.vue'
import Draggable from '@/../lib/vuedraggable/dist/vuedraggable.umd.js' import Draggable from '@/../lib/vuedraggable/dist/vuedraggable.umd.js'
import {registerIcon} from '@/utils/el-icons' import {registerIcon} from '@/utils/el-icons'
import SvgIcon from '@/components/svg-icon' //svg组件
import 'virtual:svg-icons-register' import 'virtual:svg-icons-register'
import '@/iconfont/iconfont.css' import '@/iconfont/iconfont.css'
@ -27,7 +26,6 @@ VFormDesigner.install = function (app) {
registerIcon(app) registerIcon(app)
app.component('draggable', Draggable) app.component('draggable', Draggable)
app.component('svg-icon', SvgIcon)
app.component(VFormDesigner.name, VFormDesigner) app.component(VFormDesigner.name, VFormDesigner)
} }
@ -38,7 +36,6 @@ VFormRender.install = function (app) {
app.use(ContainerItems) app.use(ContainerItems)
registerIcon(app) registerIcon(app)
app.component('svg-icon', SvgIcon)
app.component(VFormRender.name, VFormRender) app.component(VFormRender.name, VFormRender)
} }
@ -57,7 +54,6 @@ const install = (app) => {
registerIcon(app) registerIcon(app)
app.component('draggable', Draggable) app.component('draggable', Draggable)
app.component('svg-icon', SvgIcon)
components.forEach(component => { components.forEach(component => {
app.component(component.name, component) app.component(component.name, component)

View File

@ -42,10 +42,14 @@
<script> <script>
import i18n from "@/utils/i18n"; import i18n from "@/utils/i18n";
import containerMixin from "@/components/form-designer/form-widget/container-widget/containerMixin"; import containerMixin from "@/components/form-designer/form-widget/container-widget/containerMixin";
import SvgIcon from '@/components/svg-icon'
export default { export default {
name: "container-wrapper", name: "container-wrapper",
mixins: [i18n, containerMixin], mixins: [i18n, containerMixin],
components: {
SvgIcon
},
props: { props: {
widget: Object, widget: Object,
parentWidget: Object, parentWidget: Object,

View File

@ -46,6 +46,7 @@
import i18n from "@/utils/i18n"; import i18n from "@/utils/i18n";
import FieldComponents from '@/components/form-designer/form-widget/field-widget/index' import FieldComponents from '@/components/form-designer/form-widget/field-widget/index'
import refMixinDesign from "@/components/form-designer/refMixinDesign" import refMixinDesign from "@/components/form-designer/refMixinDesign"
import SvgIcon from '@/components/svg-icon'
export default { export default {
name: "GridColWidget", name: "GridColWidget",
@ -54,6 +55,7 @@
inject: ['refList'], inject: ['refList'],
components: { components: {
...FieldComponents, ...FieldComponents,
SvgIcon,
}, },
props: { props: {
widget: Object, widget: Object,

View File

@ -58,6 +58,7 @@
import i18n from "@/utils/i18n" import i18n from "@/utils/i18n"
import FieldComponents from '@/components/form-designer/form-widget/field-widget/index' import FieldComponents from '@/components/form-designer/form-widget/field-widget/index'
import refMixinDesign from "@/components/form-designer/refMixinDesign" import refMixinDesign from "@/components/form-designer/refMixinDesign"
import SvgIcon from '@/components/svg-icon'
export default { export default {
name: "TableCellWidget", name: "TableCellWidget",
@ -66,6 +67,7 @@
inject: ['refList'], inject: ['refList'],
components: { components: {
...FieldComponents, ...FieldComponents,
SvgIcon,
}, },
props: { props: {
widget: Object, widget: Object,

View File

@ -62,10 +62,14 @@
<script> <script>
import i18n from "@/utils/i18n"; import i18n from "@/utils/i18n";
import SvgIcon from '@/components/svg-icon'
export default { export default {
name: "form-item-wrapper", name: "form-item-wrapper",
mixins: [i18n], mixins: [i18n],
components: {
SvgIcon
},
props: { props: {
field: Object, field: Object,
designer: Object, designer: Object,

View File

@ -27,6 +27,7 @@
import emitter from '@/utils/emitter' import emitter from '@/utils/emitter'
import i18n, {translate} from "@/utils/i18n"; import i18n, {translate} from "@/utils/i18n";
import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin"; import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin";
import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "input-widget", name: "input-widget",
@ -60,6 +61,7 @@
}, },
components: { components: {
FormItemWrapper, FormItemWrapper,
SvgIcon,
}, },
data() { data() {
return { return {

View File

@ -58,6 +58,7 @@
import i18n, {translate} from "@/utils/i18n"; import i18n, {translate} from "@/utils/i18n";
import {deepClone} from "@/utils/util"; import {deepClone} from "@/utils/util";
import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin"; import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin";
import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "picture-upload-widget", name: "picture-upload-widget",
@ -91,6 +92,7 @@
}, },
components: { components: {
FormItemWrapper, FormItemWrapper,
SvgIcon,
}, },
data() { data() {
return { return {

View File

@ -29,11 +29,15 @@
</template> </template>
<script> <script>
import i18n from "@/utils/i18n"; import i18n from "@/utils/i18n"
import SvgIcon from '@/components/svg-icon'
export default { export default {
name: "static-content-wrapper", name: "static-content-wrapper",
mixins: [i18n], mixins: [i18n],
components: {
SvgIcon
},
props: { props: {
field: Object, field: Object,
designer: Object, designer: Object,

View File

@ -19,10 +19,14 @@
<script> <script>
import i18n from "@/utils/i18n" import i18n from "@/utils/i18n"
import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "file-upload-fileTypes-editor", name: "file-upload-fileTypes-editor",
mixins: [i18n], mixins: [i18n],
components: {
SvgIcon
},
props: { props: {
designer: Object, designer: Object,
selectedWidget: Object, selectedWidget: Object,

View File

@ -19,10 +19,14 @@
<script> <script>
import i18n from "@/utils/i18n" import i18n from "@/utils/i18n"
import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "picture-upload-fileTypes-editor", name: "picture-upload-fileTypes-editor",
mixins: [i18n], mixins: [i18n],
components: {
SvgIcon
},
props: { props: {
designer: Object, designer: Object,
selectedWidget: Object, selectedWidget: Object,

View File

@ -21,10 +21,14 @@
<script> <script>
import i18n from "@/utils/i18n" import i18n from "@/utils/i18n"
import {isEmptyStr} from "@/utils/util" import {isEmptyStr} from "@/utils/util"
import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "name-editor", name: "name-editor",
mixins: [i18n], mixins: [i18n],
components: {
SvgIcon
},
props: { props: {
designer: Object, designer: Object,
selectedWidget: Object, selectedWidget: Object,

View File

@ -6,7 +6,7 @@
<svg-icon icon-class="el-info" /></el-tooltip> <svg-icon icon-class="el-info" /></el-tooltip>
</span> </span>
</template> </template>
<el-select v-model="optionModel.validation" filterable allow-create default-first-option> <el-select v-model="optionModel.validation" filterable clearable allow-create default-first-option>
<el-option v-for="(fv, fvIdx) in fieldValidators" <el-option v-for="(fv, fvIdx) in fieldValidators"
:key="fvIdx" :key="fvIdx"
:label="fv.label" :label="fv.label"
@ -18,10 +18,14 @@
<script> <script>
import i18n from "@/utils/i18n" import i18n from "@/utils/i18n"
import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "validation-editor", name: "validation-editor",
mixins: [i18n], mixins: [i18n],
components: {
SvgIcon
},
props: { props: {
designer: Object, designer: Object,
selectedWidget: Object, selectedWidget: Object,

View File

@ -201,6 +201,7 @@
import loadBeautifier from "@/utils/beautifierLoader" import loadBeautifier from "@/utils/beautifierLoader"
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import axios from 'axios' import axios from 'axios'
import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "ToolbarPanel", name: "ToolbarPanel",
@ -209,6 +210,7 @@
VFormRender, VFormRender,
CodeEditor, CodeEditor,
Clipboard, Clipboard,
SvgIcon,
}, },
props: { props: {
designer: Object designer: Object

View File

@ -96,6 +96,7 @@
import {addWindowResizeHandler, generateId} from "@/utils/util" import {addWindowResizeHandler, generateId} from "@/utils/util"
import i18n from "@/utils/i18n" import i18n from "@/utils/i18n"
import axios from 'axios' import axios from 'axios'
import SvgIcon from "@/components/svg-icon/index";
// import ftImg1 from '@/assets/ft-images/t1.png' // import ftImg1 from '@/assets/ft-images/t1.png'
// import ftImg2 from '@/assets/ft-images/t2.png' // import ftImg2 from '@/assets/ft-images/t2.png'
@ -110,6 +111,7 @@
name: "FieldPanel", name: "FieldPanel",
mixins: [i18n], mixins: [i18n],
components: { components: {
SvgIcon
}, },
props: { props: {
designer: Object, designer: Object,

View File

@ -70,7 +70,7 @@
import ContainerItemWrapper from './container-item-wrapper' import ContainerItemWrapper from './container-item-wrapper'
import containerItemMixin from './containerItemMixin' import containerItemMixin from './containerItemMixin'
import FieldComponents from '@/components/form-designer/form-widget/field-widget/index' import FieldComponents from '@/components/form-designer/form-widget/field-widget/index'
import eventBus from "@/utils/event-bus" import SvgIcon from "@/components/svg-icon/index";
export default { export default {
name: "sub-form-item", name: "sub-form-item",
@ -79,6 +79,7 @@
components: { components: {
ContainerItemWrapper, ContainerItemWrapper,
...FieldComponents, ...FieldComponents,
SvgIcon,
}, },
props: { props: {
widget: Object, widget: Object,

View File

@ -7,7 +7,6 @@ import '@/styles/index.scss'
import '@/iconfont/iconfont.css' import '@/iconfont/iconfont.css'
import Draggable from '@/../lib/vuedraggable/dist/vuedraggable.umd.js' import Draggable from '@/../lib/vuedraggable/dist/vuedraggable.umd.js'
import {registerIcon} from '@/utils/el-icons' import {registerIcon} from '@/utils/el-icons'
import SvgIcon from '@/components/svg-icon' //svg组件
import 'virtual:svg-icons-register' import 'virtual:svg-icons-register'
import ContainerWidgets from '@/components/form-designer/form-widget/container-widget/index' import ContainerWidgets from '@/components/form-designer/form-widget/container-widget/index'
@ -26,7 +25,6 @@ const vfApp = createApp(App)
vfApp.use(ElementPlus) vfApp.use(ElementPlus)
registerIcon(vfApp) registerIcon(vfApp)
vfApp.component('draggable', Draggable) vfApp.component('draggable', Draggable)
vfApp.component('svg-icon', SvgIcon)
addDirective(vfApp) addDirective(vfApp)
installI18n(vfApp) installI18n(vfApp)