Skip to content

Commit a2ef21b

Browse files
YunaiVgitee-org
authored andcommitted
!664 【代码优化】MALL: 修复模板装修时组件属性响应式丢失的问题
Merge pull request !664 from puhui999/dev
2 parents 48e7e7e + 6254265 commit a2ef21b

File tree

36 files changed

+125
-144
lines changed

36 files changed

+125
-144
lines changed

src/components/DiyEditor/components/ComponentContainerProperty.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
</template>
5252

5353
<script setup lang="ts">
54-
import { ComponentStyle, usePropertyForm } from '@/components/DiyEditor/util'
54+
import { ComponentStyle } from '@/components/DiyEditor/util'
55+
import { useVModel } from '@vueuse/core'
5556
5657
/**
5758
* 组件容器属性:目前右边部分
@@ -61,7 +62,7 @@ defineOptions({ name: 'ComponentContainer' })
6162
6263
const props = defineProps<{ modelValue: ComponentStyle }>()
6364
const emit = defineEmits(['update:modelValue'])
64-
const { formData } = usePropertyForm(props.modelValue, emit)
65+
const formData = useVModel(props, 'modelValue', emit)
6566
6667
const treeData = [
6768
{

src/components/DiyEditor/components/mobile/Carousel/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@
9393

9494
<script setup lang="ts">
9595
import { CarouselProperty } from './config'
96-
import { usePropertyForm } from '@/components/DiyEditor/util'
96+
import { useVModel } from '@vueuse/core'
9797
9898
// 轮播图属性面板
9999
defineOptions({ name: 'CarouselProperty' })
100100
101101
const props = defineProps<{ modelValue: CarouselProperty }>()
102102
const emit = defineEmits(['update:modelValue'])
103-
const { formData } = usePropertyForm(props.modelValue, emit)
103+
const formData = useVModel(props, 'modelValue', emit)
104104
</script>
105105

106106
<style scoped lang="scss"></style>

src/components/DiyEditor/components/mobile/CouponCard/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
<script setup lang="ts">
7575
import { CouponCardProperty } from './config'
76-
import { usePropertyForm } from '@/components/DiyEditor/util'
76+
import { useVModel } from '@vueuse/core'
7777
import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
7878
import { floatToFixed2 } from '@/utils'
7979
import { PromotionDiscountTypeEnum } from '@/utils/constants'
@@ -84,7 +84,7 @@ defineOptions({ name: 'CouponCardProperty' })
8484
8585
const props = defineProps<{ modelValue: CouponCardProperty }>()
8686
const emit = defineEmits(['update:modelValue'])
87-
const { formData } = usePropertyForm(props.modelValue, emit)
87+
const formData = useVModel(props, 'modelValue', emit)
8888
8989
// 优惠券列表
9090
const couponList = ref<CouponTemplateApi.CouponTemplateVO[]>([])

src/components/DiyEditor/components/mobile/Divider/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545

4646
<script setup lang="ts">
4747
import { DividerProperty } from './config'
48-
import { usePropertyForm } from '@/components/DiyEditor/util'
48+
import { useVModel } from '@vueuse/core'
4949
// 导航栏属性面板
5050
defineOptions({ name: 'DividerProperty' })
5151
const props = defineProps<{ modelValue: DividerProperty }>()
5252
const emit = defineEmits(['update:modelValue'])
53-
const { formData } = usePropertyForm(props.modelValue, emit)
53+
const formData = useVModel(props, 'modelValue', emit)
5454
5555
//线类型
5656
const BORDER_TYPES = [

src/components/DiyEditor/components/mobile/FloatingActionButton/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131

3232
<script setup lang="ts">
3333
import { FloatingActionButtonProperty } from './config'
34-
import { usePropertyForm } from '@/components/DiyEditor/util'
34+
import { useVModel } from '@vueuse/core'
3535
3636
// 悬浮按钮属性面板
3737
defineOptions({ name: 'FloatingActionButtonProperty' })
3838
3939
const props = defineProps<{ modelValue: FloatingActionButtonProperty }>()
4040
const emit = defineEmits(['update:modelValue'])
41-
const { formData } = usePropertyForm(props.modelValue, emit)
41+
const formData = useVModel(props, 'modelValue', emit)
4242
</script>
4343

4444
<style scoped lang="scss"></style>

src/components/DiyEditor/components/mobile/HotZone/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</template>
2121

2222
<script setup lang="ts">
23-
import { usePropertyForm } from '@/components/DiyEditor/util'
23+
import { useVModel } from '@vueuse/core'
2424
import { HotZoneProperty } from '@/components/DiyEditor/components/mobile/HotZone/config'
2525
import HotZoneEditDialog from './components/HotZoneEditDialog/index.vue'
2626
@@ -29,7 +29,7 @@ defineOptions({ name: 'HotZoneProperty' })
2929
3030
const props = defineProps<{ modelValue: HotZoneProperty }>()
3131
const emit = defineEmits(['update:modelValue'])
32-
const { formData } = usePropertyForm(props.modelValue, emit)
32+
const formData = useVModel(props, 'modelValue', emit)
3333
3434
// 热区编辑对话框
3535
const editDialogRef = ref()

src/components/DiyEditor/components/mobile/ImageBar/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222
<script setup lang="ts">
2323
import { ImageBarProperty } from './config'
24-
import { usePropertyForm } from '@/components/DiyEditor/util'
24+
import { useVModel } from '@vueuse/core'
2525
2626
// 图片展示属性面板
2727
defineOptions({ name: 'ImageBarProperty' })
2828
2929
const props = defineProps<{ modelValue: ImageBarProperty }>()
3030
const emit = defineEmits(['update:modelValue'])
31-
const { formData } = usePropertyForm(props.modelValue, emit)
31+
const formData = useVModel(props, 'modelValue', emit)
3232
</script>
3333

3434
<style scoped lang="scss"></style>

src/components/DiyEditor/components/mobile/MagicCube/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
</template>
5757

5858
<script setup lang="ts">
59-
import { usePropertyForm } from '@/components/DiyEditor/util'
59+
import { useVModel } from '@vueuse/core'
6060
import { MagicCubeProperty } from '@/components/DiyEditor/components/mobile/MagicCube/config'
6161
6262
/** 广告魔方属性面板 */
6363
defineOptions({ name: 'MagicCubeProperty' })
6464
6565
const props = defineProps<{ modelValue: MagicCubeProperty }>()
6666
const emit = defineEmits(['update:modelValue'])
67-
const { formData } = usePropertyForm(props.modelValue, emit)
67+
const formData = useVModel(props, 'modelValue', emit)
6868
6969
// 选中的热区
7070
const selectedHotAreaIndex = ref(-1)

src/components/DiyEditor/components/mobile/MenuGrid/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</template>
4949

5050
<script setup lang="ts">
51-
import { usePropertyForm } from '@/components/DiyEditor/util'
51+
import { useVModel } from '@vueuse/core'
5252
import {
5353
EMPTY_MENU_GRID_ITEM_PROPERTY,
5454
MenuGridProperty
@@ -59,7 +59,7 @@ defineOptions({ name: 'MenuGridProperty' })
5959
6060
const props = defineProps<{ modelValue: MenuGridProperty }>()
6161
const emit = defineEmits(['update:modelValue'])
62-
const { formData } = usePropertyForm(props.modelValue, emit)
62+
const formData = useVModel(props, 'modelValue', emit)
6363
</script>
6464

6565
<style scoped lang="scss"></style>

src/components/DiyEditor/components/mobile/MenuList/property.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</template>
2929

3030
<script setup lang="ts">
31-
import { usePropertyForm } from '@/components/DiyEditor/util'
31+
import { useVModel } from '@vueuse/core'
3232
import {
3333
EMPTY_MENU_LIST_ITEM_PROPERTY,
3434
MenuListProperty
@@ -39,7 +39,7 @@ defineOptions({ name: 'MenuListProperty' })
3939
4040
const props = defineProps<{ modelValue: MenuListProperty }>()
4141
const emit = defineEmits(['update:modelValue'])
42-
const { formData } = usePropertyForm(props.modelValue, emit)
42+
const formData = useVModel(props, 'modelValue', emit)
4343
</script>
4444

4545
<style scoped lang="scss"></style>

0 commit comments

Comments
 (0)