Skip to content

Commit 9c2b13f

Browse files
author
puhui999
committed
【缺陷修复】商城装修: TitleBar 背景图设置统一为使用组件样式进行设置
1 parent e0e287c commit 9c2b13f

File tree

3 files changed

+40
-39
lines changed

3 files changed

+40
-39
lines changed

src/components/DiyEditor/components/mobile/TitleBar/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
1+
import {ComponentStyle, DiyComponent} from '@/components/DiyEditor/util'
22

33
/** 标题栏属性 */
44
export interface TitleBarProperty {
5-
// 背景图
6-
bgImgUrl: string
75
// 偏移
86
marginLeft: number
97
// 显示位置

src/components/DiyEditor/components/mobile/TitleBar/index.vue

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,63 @@
11
<template>
2-
<div class="title-bar">
3-
<el-image v-if="property.bgImgUrl" :src="property.bgImgUrl" fit="cover" class="w-full" />
4-
<div class="absolute left-0 top-0 w-full">
2+
<div
3+
:style="{
4+
background:
5+
property.style.bgType === 'color' ? property.style.bgColor : `url(${property.style.bgImg})`,
6+
backgroundSize: '100% 100%',
7+
backgroundRepeat: 'no-repeat'
8+
}"
9+
class="title-bar"
10+
>
11+
<!-- 内容 -->
12+
<div>
513
<!-- 标题 -->
614
<div
15+
v-if="property.title"
716
:style="{
817
fontSize: `${property.titleSize}px`,
918
fontWeight: property.titleWeight,
1019
color: property.titleColor,
1120
textAlign: property.textAlign
1221
}"
13-
v-if="property.title"
1422
>
1523
{{ property.title }}
1624
</div>
1725
<!-- 副标题 -->
1826
<div
27+
v-if="property.description"
1928
:style="{
2029
fontSize: `${property.descriptionSize}px`,
2130
fontWeight: property.descriptionWeight,
2231
color: property.descriptionColor,
2332
textAlign: property.textAlign
2433
}"
2534
class="m-t-8px"
26-
v-if="property.description"
2735
>
2836
{{ property.description }}
2937
</div>
3038
</div>
3139
<!-- 更多 -->
3240
<div
33-
class="more"
3441
v-show="property.more.show"
3542
:style="{
3643
color: property.descriptionColor
3744
}"
45+
class="more"
3846
>
3947
<span v-if="property.more.type !== 'icon'"> {{ property.more.text }} </span>
40-
<Icon icon="ep:arrow-right" v-if="property.more.type !== 'text'" />
48+
<Icon v-if="property.more.type !== 'text'" icon="ep:arrow-right" />
4149
</div>
4250
</div>
4351
</template>
44-
<script setup lang="ts">
52+
<script lang="ts" setup>
4553
import { TitleBarProperty } from './config'
4654
4755
/** 标题栏 */
4856
defineOptions({ name: 'TitleBar' })
4957
5058
defineProps<{ property: TitleBarProperty }>()
5159
</script>
52-
<style scoped lang="scss">
60+
<style lang="scss" scoped>
5361
.title-bar {
5462
position: relative;
5563
width: 100%;
Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
<template>
22
<ComponentContainerProperty v-model="formData.style">
3-
<el-form label-width="85px" :model="formData" :rules="rules">
4-
<el-card header="风格" class="property-group" shadow="never">
5-
<el-form-item label="背景图片" prop="bgImgUrl">
6-
<UploadImg v-model="formData.bgImgUrl" width="100%" height="40px">
7-
<template #tip>建议尺寸 750*80</template>
8-
</UploadImg>
9-
</el-form-item>
3+
<el-form :model="formData" :rules="rules" label-width="85px">
4+
<el-card class="property-group" header="风格" shadow="never">
105
<el-form-item label="标题位置" prop="textAlign">
116
<el-radio-group v-model="formData!.textAlign">
127
<el-tooltip content="居左" placement="top">
@@ -22,65 +17,65 @@
2217
</el-radio-group>
2318
</el-form-item>
2419
</el-card>
25-
<el-card header="主标题" class="property-group" shadow="never">
26-
<el-form-item label="文字" prop="title" label-width="40px">
20+
<el-card class="property-group" header="主标题" shadow="never">
21+
<el-form-item label="文字" label-width="40px" prop="title">
2722
<InputWithColor
2823
v-model="formData.title"
2924
v-model:color="formData.titleColor"
30-
show-word-limit
3125
maxlength="20"
26+
show-word-limit
3227
/>
3328
</el-form-item>
34-
<el-form-item label="大小" prop="titleSize" label-width="40px">
29+
<el-form-item label="大小" label-width="40px" prop="titleSize">
3530
<el-slider
3631
v-model="formData.titleSize"
3732
:max="60"
3833
:min="10"
39-
show-input
4034
input-size="small"
35+
show-input
4136
/>
4237
</el-form-item>
43-
<el-form-item label="粗细" prop="titleWeight" label-width="40px">
38+
<el-form-item label="粗细" label-width="40px" prop="titleWeight">
4439
<el-slider
4540
v-model="formData.titleWeight"
46-
:min="100"
4741
:max="900"
42+
:min="100"
4843
:step="100"
49-
show-input
5044
input-size="small"
45+
show-input
5146
/>
5247
</el-form-item>
5348
</el-card>
54-
<el-card header="副标题" class="property-group" shadow="never">
55-
<el-form-item label="文字" prop="description" label-width="40px">
49+
<el-card class="property-group" header="副标题" shadow="never">
50+
<el-form-item label="文字" label-width="40px" prop="description">
5651
<InputWithColor
5752
v-model="formData.description"
5853
v-model:color="formData.descriptionColor"
59-
show-word-limit
6054
maxlength="50"
55+
show-word-limit
6156
/>
6257
</el-form-item>
63-
<el-form-item label="大小" prop="descriptionSize" label-width="40px">
58+
<el-form-item label="大小" label-width="40px" prop="descriptionSize">
6459
<el-slider
6560
v-model="formData.descriptionSize"
6661
:max="60"
6762
:min="10"
68-
show-input
6963
input-size="small"
64+
show-input
7065
/>
7166
</el-form-item>
72-
<el-form-item label="粗细" prop="descriptionWeight" label-width="40px">
67+
<el-form-item label="粗细" label-width="40px" prop="descriptionWeight">
7368
<el-slider
7469
v-model="formData.descriptionWeight"
75-
:min="100"
7670
:max="900"
71+
:min="100"
7772
:step="100"
78-
show-input
7973
input-size="small"
74+
show-input
8075
/>
8176
</el-form-item>
8277
</el-card>
83-
<el-card header="查看更多" class="property-group" shadow="never">
78+
<el-card class="property-group" header="查看更多" shadow="never">
8479
<el-form-item label="是否显示" prop="more.show">
8580
<el-checkbox v-model="formData.more.show" />
8681
</el-form-item>
@@ -93,7 +88,7 @@
9388
<el-radio value="all">文字+图标</el-radio>
9489
</el-radio-group>
9590
</el-form-item>
96-
<el-form-item label="更多文字" prop="more.text" v-show="formData.more.type !== 'icon'">
91+
<el-form-item v-show="formData.more.type !== 'icon'" label="更多文字" prop="more.text">
9792
<el-input v-model="formData.more.text" />
9893
</el-form-item>
9994
<el-form-item label="跳转链接" prop="more.url">
@@ -104,7 +99,7 @@
10499
</el-form>
105100
</ComponentContainerProperty>
106101
</template>
107-
<script setup lang="ts">
102+
<script lang="ts" setup>
108103
import { TitleBarProperty } from './config'
109104
import { usePropertyForm } from '@/components/DiyEditor/util'
110105
// 导航栏属性面板
@@ -118,4 +113,4 @@ const { formData } = usePropertyForm(props.modelValue, emit)
118113
const rules = {}
119114
</script>
120115

121-
<style scoped lang="scss"></style>
116+
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)