商城装修:修复同一类型的组件切换时,右侧属性面板不更新的问题
This commit is contained in:
parent
a7512ba2c7
commit
9ff4f1f7a9
@ -82,7 +82,9 @@ watch(
|
||||
|
||||
// 克隆组件
|
||||
const handleCloneComponent = (component: DiyComponent<any>) => {
|
||||
return cloneDeep(component)
|
||||
const instance = cloneDeep(component)
|
||||
instance.uid = new Date().getTime()
|
||||
return instance
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -111,6 +111,7 @@
|
||||
view-class="p-[var(--el-card-padding)] p-b-[calc(var(--el-card-padding)+var(--el-card-padding))] property"
|
||||
>
|
||||
<component
|
||||
:key="selectedComponent?.uid || selectedComponent?.id"
|
||||
:is="selectedComponent?.id + 'Property'"
|
||||
v-model="selectedComponent.property"
|
||||
/>
|
||||
@ -296,6 +297,7 @@ const handleMoveComponent = (index: number, direction: number) => {
|
||||
/** 复制组件 */
|
||||
const handleCopyComponent = (index: number) => {
|
||||
const component = cloneDeep(pageComponents.value[index])
|
||||
component.uid = new Date().getTime()
|
||||
pageComponents.value.splice(index + 1, 0, component)
|
||||
}
|
||||
/**
|
||||
|
@ -5,6 +5,8 @@ import { TabBarProperty } from '@/components/DiyEditor/components/mobile/TabBar/
|
||||
|
||||
// 页面装修组件
|
||||
export interface DiyComponent<T> {
|
||||
// 用于区分同一种组件的不同实例
|
||||
uid: number
|
||||
// 组件唯一标识
|
||||
id: string
|
||||
// 组件名称
|
||||
|
Loading…
Reference in New Issue
Block a user