grid-item组件改名为vf-grid-item,以解决与VueLayoutGrid组件冲突的问题。

This commit is contained in:
vdpAdmin 2022-10-21 14:47:49 +08:00
parent 7982a55ac4
commit 38af2fd516
7 changed files with 17 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<template v-if="!!widget.widgetList && (widget.widgetList.length > 0)"> <template v-if="!!widget.widgetList && (widget.widgetList.length > 0)">
<template v-for="(subWidget, swIdx) in widget.widgetList"> <template v-for="(subWidget, swIdx) in widget.widgetList">
<template v-if="'container' === subWidget.category"> <template v-if="'container' === subWidget.category">
<component :is="subWidget.type + '-item'" :widget="subWidget" :key="swIdx" :parent-list="widget.widgetList" <component :is="getComponentByContainer(subWidget)" :widget="subWidget" :key="swIdx" :parent-list="widget.widgetList"
:index-of-parent-list="swIdx" :parent-widget="widget"> :index-of-parent-list="swIdx" :parent-widget="widget">
<!-- 递归传递插槽 --> <!-- 递归传递插槽 -->
<template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope"> <template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope">

View File

@ -28,7 +28,7 @@
import containerItemMixin from "./containerItemMixin" import containerItemMixin from "./containerItemMixin"
export default { export default {
name: "grid-item", name: "vf-grid-item", //grid-itemVueGridLayout
componentName: 'ContainerItem', componentName: 'ContainerItem',
mixins: [emitter, i18n, refMixin, containerItemMixin], mixins: [emitter, i18n, refMixin, containerItemMixin],
components: { components: {

View File

@ -8,7 +8,7 @@
:disabled="tab.options.disabled" :name="tab.options.name"> :disabled="tab.options.disabled" :name="tab.options.name">
<template v-for="(subWidget, swIdx) in tab.widgetList"> <template v-for="(subWidget, swIdx) in tab.widgetList">
<template v-if="'container' === subWidget.category"> <template v-if="'container' === subWidget.category">
<component :is="subWidget.type + '-item'" :widget="subWidget" :key="swIdx" :parent-list="tab.widgetList" <component :is="getComponentByContainer(subWidget)" :widget="subWidget" :key="swIdx" :parent-list="tab.widgetList"
:index-of-parent-list="swIdx" :parent-widget="widget"> :index-of-parent-list="swIdx" :parent-widget="widget">
<!-- 递归传递插槽 --> <!-- 递归传递插槽 -->
<template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope"> <template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope">

View File

@ -4,7 +4,7 @@
:style="{width: widget.options.cellWidth + ' !important' || '', height: widget.options.cellHeight + ' !important' || ''}"> :style="{width: widget.options.cellWidth + ' !important' || '', height: widget.options.cellHeight + ' !important' || ''}">
<template v-for="(subWidget, swIdx) in widget.widgetList"> <template v-for="(subWidget, swIdx) in widget.widgetList">
<template v-if="'container' === subWidget.category"> <template v-if="'container' === subWidget.category">
<component :is="subWidget.type + '-item'" :widget="subWidget" :key="swIdx" :parent-list="widget.widgetList" <component :is="getComponentByContainer(subWidget)" :widget="subWidget" :key="swIdx" :parent-list="widget.widgetList"
:index-of-parent-list="swIdx" :parent-widget="widget"> :index-of-parent-list="swIdx" :parent-widget="widget">
<!-- 递归传递插槽 --> <!-- 递归传递插槽 -->
<template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope"> <template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope">

View File

@ -164,6 +164,10 @@
}, },
getContainerWidgetName(widget) { getContainerWidgetName(widget) {
if (widget.type === 'grid') { //grid-itemVueGridLayout
return 'vf-grid-item'
}
return widget.type + '-item' return widget.type + '-item'
}, },

View File

@ -18,5 +18,13 @@ export default {
return this.refList['v_form_ref'] return this.refList['v_form_ref']
}, },
getComponentByContainer(con) {
if (con.type === 'grid') { //grid-item跟VueGridLayout全局注册组件重名故特殊处理
return 'vf-grid-item'
}
return con.type + '-item'
},
} }
} }

View File

@ -19,7 +19,7 @@
<template v-if="!!widget.widgetList && (widget.widgetList.length > 0)"> <template v-if="!!widget.widgetList && (widget.widgetList.length > 0)">
<template v-for="(subWidget, swIdx) in widget.widgetList"> <template v-for="(subWidget, swIdx) in widget.widgetList">
<template v-if="'container' === subWidget.category"> <template v-if="'container' === subWidget.category">
<component :is="subWidget.type + '-item'" :widget="subWidget" :key="swIdx" :parent-list="widget.widgetList" <component :is="getComponentByContainer(subWidget)" :widget="subWidget" :key="swIdx" :parent-list="widget.widgetList"
:index-of-parent-list="swIdx" :parent-widget="widget"> :index-of-parent-list="swIdx" :parent-widget="widget">
<!-- 递归传递插槽 --> <!-- 递归传递插槽 -->
<template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope"> <template v-for="slot in Object.keys($slots)" v-slot:[slot]="scope">