@travel-screen/l-module-components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -0
- package/package.json +34 -0
- package/src/index.js +60 -0
- package/src/l-bar-chart/README.md +302 -0
- package/src/l-bar-chart/index.vue +405 -0
- package/src/l-bar-chart/interface/index.js +210 -0
- package/src/l-data-panel/README.md +331 -0
- package/src/l-data-panel/img/images.js +47 -0
- package/src/l-data-panel/img/l-data-panel_bg_1.png +0 -0
- package/src/l-data-panel/img/l-data-panel_bg_2.png +0 -0
- package/src/l-data-panel/img/l-data-panel_bg_3.png +0 -0
- package/src/l-data-panel/index.vue +150 -0
- package/src/l-data-panel/interface/index.js +249 -0
- package/src/l-data-ring/README.md +292 -0
- package/src/l-data-ring/img/images.js +21 -0
- package/src/l-data-ring/img/l-data-ring_bg.png +0 -0
- package/src/l-data-ring/index.vue +93 -0
- package/src/l-data-ring/interface/index.js +116 -0
- package/src/l-date-picker/README.md +276 -0
- package/src/l-date-picker/index.vue +185 -0
- package/src/l-date-picker/interface/index.js +128 -0
- package/src/l-icon-label/README.md +356 -0
- package/src/l-icon-label/img/images.js +28 -0
- package/src/l-icon-label/img/l-icon-label_bg.png +0 -0
- package/src/l-icon-label/img/l-icon-label_icon.png +0 -0
- package/src/l-icon-label/index.vue +162 -0
- package/src/l-icon-label/interface/index.js +234 -0
- package/src/l-label-value/README.md +358 -0
- package/src/l-label-value/img/images.js +19 -0
- package/src/l-label-value/img/l-label-value_line.png +0 -0
- package/src/l-label-value/index.vue +132 -0
- package/src/l-label-value/interface/index.js +116 -0
- package/src/l-metric-tile/README.md +391 -0
- package/src/l-metric-tile/img/images.js +19 -0
- package/src/l-metric-tile/img/l-metric-tile_bg_1.png +0 -0
- package/src/l-metric-tile/index.vue +138 -0
- package/src/l-metric-tile/interface/index.js +241 -0
- package/src/l-module-box/README.md +289 -0
- package/src/l-module-box/img/images.js +28 -0
- package/src/l-module-box/img/l-module-box_bg.png +0 -0
- package/src/l-module-box/img/l-module-box_icon.png +0 -0
- package/src/l-module-box/index.vue +125 -0
- package/src/l-module-box/interface/index.js +93 -0
- package/src/l-module-tag/README.md +243 -0
- package/src/l-module-tag/index.vue +137 -0
- package/src/l-module-tag/interface/index.js +91 -0
- package/src/l-rank-list/README.md +553 -0
- package/src/l-rank-list/img/images.js +34 -0
- package/src/l-rank-list/img/l-rank-list_icon_line.png +0 -0
- package/src/l-rank-list/img/l-rank-list_icon_rank_1.png +0 -0
- package/src/l-rank-list/img/l-rank-list_icon_rank_2.png +0 -0
- package/src/l-rank-list/img/l-rank-list_icon_rank_other.png +0 -0
- package/src/l-rank-list/index.vue +610 -0
- package/src/l-rank-list/interface/index.js +343 -0
- package/src/l-stat-card/README.md +309 -0
- package/src/l-stat-card/img/images.js +36 -0
- package/src/l-stat-card/img/img-bg.png +0 -0
- package/src/l-stat-card/img/l-stat-card_img_1.png +0 -0
- package/src/l-stat-card/index.vue +136 -0
- package/src/l-stat-card/interface/index.js +159 -0
- package/src/l-tabs/README.md +285 -0
- package/src/l-tabs/img/images.js +19 -0
- package/src/l-tabs/img/l-tabs_bg.png +0 -0
- package/src/l-tabs/index.vue +97 -0
- package/src/l-tabs/interface/index.js +115 -0
- package/src/l-trend-card/README.md +415 -0
- package/src/l-trend-card/img/images.js +41 -0
- package/src/l-trend-card/img/l-trend-card_bg.png +0 -0
- package/src/l-trend-card/img/l-trend-card_icon_1.png +0 -0
- package/src/l-trend-card/img/l-trend-card_icon_down.png +0 -0
- package/src/l-trend-card/img/l-trend-card_icon_up.png +0 -0
- package/src/l-trend-card/index.vue +181 -0
- package/src/l-trend-card/interface/index.js +243 -0
- package/src/utils/tooltip.js +30 -0
- package/src/utils/util.js +27 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="l-metric-tile" :style="cardStyle">
|
|
3
|
+
<!-- layoutType='title-top'(默认):标题在上,数值在下 -->
|
|
4
|
+
<template v-if="layoutType === 'title-top'">
|
|
5
|
+
<div class="l-metric-tile__title" :style="titleStyle">{{ title }}</div>
|
|
6
|
+
<div class="l-metric-tile__value" :style="valueContainerStyle">
|
|
7
|
+
<span class="l-metric-tile__value-num" :style="numStyle">{{ data }}</span>
|
|
8
|
+
<span class="l-metric-tile__value-unit" :style="unitStyle">{{ unit }}</span>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<!-- layoutType='title-bottom':数值在上,标题在下 -->
|
|
12
|
+
<template v-else>
|
|
13
|
+
<div class="l-metric-tile__value" :style="valueContainerStyle">
|
|
14
|
+
<span class="l-metric-tile__value-num" :style="numStyle">{{ data }}</span>
|
|
15
|
+
<span class="l-metric-tile__value-unit" :style="unitStyle">{{ unit }}</span>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="l-metric-tile__title" :style="titleStyle">{{ title }}</div>
|
|
18
|
+
</template>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import interfaceObj from './interface/index'
|
|
24
|
+
import { getBgPath } from './img/images'
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'LMetricTile',
|
|
28
|
+
props: interfaceObj,
|
|
29
|
+
components: {},
|
|
30
|
+
data() {
|
|
31
|
+
return {}
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
// 背景图(外部传入优先,否则使用默认)
|
|
35
|
+
computedBgImage() {
|
|
36
|
+
if (this.bgImage) {
|
|
37
|
+
return this.bgImage
|
|
38
|
+
}
|
|
39
|
+
// 使用默认背景图
|
|
40
|
+
return getBgPath(1)
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// 卡片容器样式
|
|
44
|
+
cardStyle() {
|
|
45
|
+
return {
|
|
46
|
+
width: typeof this.cardWidth === 'number' ? `${this.cardWidth}px` : this.cardWidth,
|
|
47
|
+
height: typeof this.cardHeight === 'number' ? `${this.cardHeight}px` : this.cardHeight,
|
|
48
|
+
padding: typeof this.cardPadding === 'number' ? `${this.cardPadding}px` : this.cardPadding,
|
|
49
|
+
paddingLeft: typeof this.cardPaddingLeft === 'number' ? `${this.cardPaddingLeft}px` : this.cardPaddingLeft,
|
|
50
|
+
paddingTop: typeof this.cardPaddingTop === 'number' ? `${this.cardPaddingTop}px` : this.cardPaddingTop,
|
|
51
|
+
display: this.cardDisplay,
|
|
52
|
+
flexDirection: this.cardFlexDirection,
|
|
53
|
+
alignItems: this.cardAlignItems,
|
|
54
|
+
justifyContent: this.cardJustifyContent,
|
|
55
|
+
boxSizing: this.cardBoxSizing,
|
|
56
|
+
background: this.computedBgImage ? `url(${this.computedBgImage}) 0 0 no-repeat` : '',
|
|
57
|
+
backgroundSize: this.cardBgSize
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// 标题样式
|
|
62
|
+
titleStyle() {
|
|
63
|
+
return {
|
|
64
|
+
fontFamily: this.titleFontFamily,
|
|
65
|
+
fontWeight: this.titleFontWeight,
|
|
66
|
+
fontSize: typeof this.titleFontSize === 'number' ? `${this.titleFontSize}px` : this.titleFontSize,
|
|
67
|
+
color: this.titleColor,
|
|
68
|
+
lineHeight: this.titleLineHeight,
|
|
69
|
+
// 根据布局类型调整边距方向
|
|
70
|
+
marginBottom: this.layoutType === 'title-top'
|
|
71
|
+
? (typeof this.titleMarginBottom === 'number' ? `${this.titleMarginBottom}px` : this.titleMarginBottom)
|
|
72
|
+
: 0,
|
|
73
|
+
marginTop: this.layoutType === 'title-bottom'
|
|
74
|
+
? (typeof this.titleMarginBottom === 'number' ? `${this.titleMarginBottom}px` : this.titleMarginBottom)
|
|
75
|
+
: 0,
|
|
76
|
+
textAlign: this.titleTextAlign,
|
|
77
|
+
padding: typeof this.titlePadding === 'number' ? `${this.titlePadding}px` : this.titlePadding
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// 数值容器样式
|
|
82
|
+
valueContainerStyle() {
|
|
83
|
+
return {
|
|
84
|
+
display: this.numDisplay,
|
|
85
|
+
alignItems: this.numAlignItems,
|
|
86
|
+
lineHeight: this.numLineHeight,
|
|
87
|
+
// 根据布局类型调整边距方向
|
|
88
|
+
marginBottom: this.layoutType === 'title-top'
|
|
89
|
+
? (typeof this.numMarginBottom === 'number' ? `${this.numMarginBottom}px` : this.numMarginBottom)
|
|
90
|
+
: 0,
|
|
91
|
+
marginTop: this.layoutType === 'title-bottom'
|
|
92
|
+
? (typeof this.numMarginBottom === 'number' ? `${this.numMarginBottom}px` : this.numMarginBottom)
|
|
93
|
+
: 0,
|
|
94
|
+
justifyContent: this.numJustifyContent
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// 数值样式
|
|
99
|
+
numStyle() {
|
|
100
|
+
return {
|
|
101
|
+
fontFamily: this.numFontFamily,
|
|
102
|
+
fontWeight: this.numFontWeight,
|
|
103
|
+
fontStyle: this.numFontStyle,
|
|
104
|
+
fontSize: typeof this.numFontSize === 'number' ? `${this.numFontSize}px` : this.numFontSize,
|
|
105
|
+
color: this.numColor,
|
|
106
|
+
background: this.numBackground,
|
|
107
|
+
WebkitBackgroundClip: this.numBackgroundClip,
|
|
108
|
+
backgroundClip: this.numBackgroundClip,
|
|
109
|
+
textShadow: this.numTextShadow,
|
|
110
|
+
paddingRight: typeof this.numPaddingRight === 'number' ? `${this.numPaddingRight}px` : this.numPaddingRight,
|
|
111
|
+
marginRight: typeof this.numMarginRight === 'number' ? `${this.numMarginRight}px` : this.numMarginRight
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
// 单位样式
|
|
116
|
+
unitStyle() {
|
|
117
|
+
return {
|
|
118
|
+
fontFamily: this.unitFontFamily,
|
|
119
|
+
fontWeight: this.unitFontWeight,
|
|
120
|
+
fontSize: typeof this.unitFontSize === 'number' ? `${this.unitFontSize}px` : this.unitFontSize,
|
|
121
|
+
color: this.unitColor,
|
|
122
|
+
lineHeight: this.unitLineHeight,
|
|
123
|
+
marginLeft: typeof this.unitMarginLeft === 'number' ? `${this.unitMarginLeft}px` : this.unitMarginLeft
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
watch: {},
|
|
128
|
+
mounted() {},
|
|
129
|
+
created() {},
|
|
130
|
+
methods: {}
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<style lang="scss" scoped>
|
|
135
|
+
.l-metric-tile {
|
|
136
|
+
// 所有样式通过内联样式控制
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const interfaceObj = {
|
|
2
|
+
// 标题文本:显示在卡片上的标题文字
|
|
3
|
+
title: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: '标题'
|
|
6
|
+
},
|
|
7
|
+
// 数值:卡片显示的主要数据值
|
|
8
|
+
data: {
|
|
9
|
+
type: [String, Number],
|
|
10
|
+
default: 0
|
|
11
|
+
},
|
|
12
|
+
// 单位:数值后面的单位文字(如:道、家、个等)
|
|
13
|
+
unit: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
17
|
+
// 背景图:卡片容器的背景图片URL,未传入时使用默认背景图
|
|
18
|
+
bgImage: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ''
|
|
21
|
+
},
|
|
22
|
+
// 布局类型:控制标题和数值的上下位置
|
|
23
|
+
// 'title-top'(默认):标题在上,数值在下
|
|
24
|
+
// 'title-bottom':数值在上,标题在下
|
|
25
|
+
layoutType: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'title-top'
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// ========== 卡片容器相关 ==========
|
|
31
|
+
// 卡片宽度:整个卡片的宽度
|
|
32
|
+
cardWidth: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: '95px'
|
|
35
|
+
},
|
|
36
|
+
// 卡片高度:整个卡片的高度
|
|
37
|
+
cardHeight: {
|
|
38
|
+
type: [String, Number],
|
|
39
|
+
default: '70px'
|
|
40
|
+
},
|
|
41
|
+
// 卡片内边距:卡片内容与边缘的间距
|
|
42
|
+
cardPadding: {
|
|
43
|
+
type: [String, Number],
|
|
44
|
+
default: 0
|
|
45
|
+
},
|
|
46
|
+
// 卡片左侧内边距:卡片左侧内容与边缘的间距
|
|
47
|
+
cardPaddingLeft: {
|
|
48
|
+
type: [String, Number],
|
|
49
|
+
default: 0
|
|
50
|
+
},
|
|
51
|
+
// 卡片顶部内边距:卡片顶部内容与边缘的间距
|
|
52
|
+
cardPaddingTop: {
|
|
53
|
+
type: [String, Number],
|
|
54
|
+
default: 0
|
|
55
|
+
},
|
|
56
|
+
// 卡片显示方式:CSS display属性
|
|
57
|
+
cardDisplay: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'flex'
|
|
60
|
+
},
|
|
61
|
+
// 卡片主轴方向:flex布局的主轴方向(column为垂直)
|
|
62
|
+
cardFlexDirection: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'column'
|
|
65
|
+
},
|
|
66
|
+
// 卡片交叉轴对齐:flex布局的交叉轴对齐方式
|
|
67
|
+
cardAlignItems: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'center'
|
|
70
|
+
},
|
|
71
|
+
// 卡片主轴对齐:flex布局的主轴对齐方式
|
|
72
|
+
cardJustifyContent: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: 'center'
|
|
75
|
+
},
|
|
76
|
+
// 卡片盒模型:CSS box-sizing属性
|
|
77
|
+
cardBoxSizing: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'border-box'
|
|
80
|
+
},
|
|
81
|
+
// 背景图尺寸:背景图的缩放方式(如:100% 100%)
|
|
82
|
+
cardBgSize: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: '100% 100%'
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// ========== 标题相关 ==========
|
|
88
|
+
// 标题字体:标题文字的字体族
|
|
89
|
+
titleFontFamily: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: 'PingFangSC, PingFang SC'
|
|
92
|
+
},
|
|
93
|
+
// 标题字重:标题文字的粗细
|
|
94
|
+
titleFontWeight: {
|
|
95
|
+
type: [String, Number],
|
|
96
|
+
default: 400
|
|
97
|
+
},
|
|
98
|
+
// 标题字号:标题文字的大小
|
|
99
|
+
titleFontSize: {
|
|
100
|
+
type: [String, Number],
|
|
101
|
+
default: '14px'
|
|
102
|
+
},
|
|
103
|
+
// 标题颜色:标题文字的颜色
|
|
104
|
+
titleColor: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: '#ffffff'
|
|
107
|
+
},
|
|
108
|
+
// 标题行高:标题文字的行高
|
|
109
|
+
titleLineHeight: {
|
|
110
|
+
type: [String, Number],
|
|
111
|
+
default: 1
|
|
112
|
+
},
|
|
113
|
+
// 标题下边距:标题与下方数值的间距
|
|
114
|
+
titleMarginBottom: {
|
|
115
|
+
type: [String, Number],
|
|
116
|
+
default: '10px'
|
|
117
|
+
},
|
|
118
|
+
// 标题对齐方式:标题文字的水平对齐
|
|
119
|
+
titleTextAlign: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: 'center'
|
|
122
|
+
},
|
|
123
|
+
// 标题内边距:标题文字的内边距
|
|
124
|
+
titlePadding: {
|
|
125
|
+
type: [String, Number],
|
|
126
|
+
default: 0
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
// ========== 数值容器相关 ==========
|
|
130
|
+
// 数值容器显示方式:数值区域的CSS display属性
|
|
131
|
+
numDisplay: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: 'flex'
|
|
134
|
+
},
|
|
135
|
+
// 数值容器交叉轴对齐:数值区域的flex交叉轴对齐
|
|
136
|
+
numAlignItems: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: 'baseline'
|
|
139
|
+
},
|
|
140
|
+
// 数值容器行高:数值区域的行高
|
|
141
|
+
numLineHeight: {
|
|
142
|
+
type: [String, Number],
|
|
143
|
+
default: 1
|
|
144
|
+
},
|
|
145
|
+
// 数值容器下边距:数值区域与下方的间距
|
|
146
|
+
numMarginBottom: {
|
|
147
|
+
type: [String, Number],
|
|
148
|
+
default: 0
|
|
149
|
+
},
|
|
150
|
+
// 数值容器主轴对齐:数值区域的flex主轴对齐
|
|
151
|
+
numJustifyContent: {
|
|
152
|
+
type: String,
|
|
153
|
+
default: 'center'
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
// ========== 数值相关 ==========
|
|
157
|
+
// 数值字体:数值文字的字体族
|
|
158
|
+
numFontFamily: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: 'DINAlternate, DIN Alternate, YouSheBiaoTiHei, sans-serif'
|
|
161
|
+
},
|
|
162
|
+
// 数值字重:数值文字的粗细
|
|
163
|
+
numFontWeight: {
|
|
164
|
+
type: [String, Number],
|
|
165
|
+
default: 'bold'
|
|
166
|
+
},
|
|
167
|
+
// 数值字体样式:数值文字的样式(italic为斜体)
|
|
168
|
+
numFontStyle: {
|
|
169
|
+
type: String,
|
|
170
|
+
default: 'italic'
|
|
171
|
+
},
|
|
172
|
+
// 数值字号:数值文字的大小
|
|
173
|
+
numFontSize: {
|
|
174
|
+
type: [String, Number],
|
|
175
|
+
default: '20px'
|
|
176
|
+
},
|
|
177
|
+
// 数值颜色:数值文字的颜色(使用渐变时设为transparent)
|
|
178
|
+
numColor: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: 'transparent'
|
|
181
|
+
},
|
|
182
|
+
// 数值渐变背景:数值文字的渐变背景(实现渐变文字效果)
|
|
183
|
+
numBackground: {
|
|
184
|
+
type: String,
|
|
185
|
+
default: 'linear-gradient(180deg, #ffffff 0%, #4aefa0 100%)'
|
|
186
|
+
},
|
|
187
|
+
// 数值背景裁剪:背景裁剪方式(text表示只在文字上显示背景)
|
|
188
|
+
numBackgroundClip: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: 'text'
|
|
191
|
+
},
|
|
192
|
+
// 数值文字阴影:数值文字的阴影效果
|
|
193
|
+
numTextShadow: {
|
|
194
|
+
type: String,
|
|
195
|
+
default: '0px 2px 6px rgba(74, 239, 160, 0.5)'
|
|
196
|
+
},
|
|
197
|
+
// 数值右内边距:数值文字右侧的内边距
|
|
198
|
+
numPaddingRight: {
|
|
199
|
+
type: [String, Number],
|
|
200
|
+
default: '3px'
|
|
201
|
+
},
|
|
202
|
+
// 数值右边距:数值与单位之间的外边距
|
|
203
|
+
numMarginRight: {
|
|
204
|
+
type: [String, Number],
|
|
205
|
+
default: '4px'
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
// ========== 单位相关 ==========
|
|
209
|
+
// 单位字体:单位文字的字体族
|
|
210
|
+
unitFontFamily: {
|
|
211
|
+
type: String,
|
|
212
|
+
default: 'PingFangSC, PingFang SC'
|
|
213
|
+
},
|
|
214
|
+
// 单位字重:单位文字的粗细
|
|
215
|
+
unitFontWeight: {
|
|
216
|
+
type: [String, Number],
|
|
217
|
+
default: 400
|
|
218
|
+
},
|
|
219
|
+
// 单位字号:单位文字的大小
|
|
220
|
+
unitFontSize: {
|
|
221
|
+
type: [String, Number],
|
|
222
|
+
default: '12px'
|
|
223
|
+
},
|
|
224
|
+
// 单位颜色:单位文字的颜色
|
|
225
|
+
unitColor: {
|
|
226
|
+
type: String,
|
|
227
|
+
default: '#ffffff'
|
|
228
|
+
},
|
|
229
|
+
// 单位行高:单位文字的行高
|
|
230
|
+
unitLineHeight: {
|
|
231
|
+
type: [String, Number],
|
|
232
|
+
default: 1
|
|
233
|
+
},
|
|
234
|
+
// 单位左边距:单位与数值之间的间距
|
|
235
|
+
unitMarginLeft: {
|
|
236
|
+
type: [String, Number],
|
|
237
|
+
default: 0
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export default interfaceObj
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
---
|
|
2
|
+
AIGC:
|
|
3
|
+
ContentProducer: '001191110102MAD55U9H0F10002'
|
|
4
|
+
ContentPropagator: '001191110102MAD55U9H0F10002'
|
|
5
|
+
Label: '1'
|
|
6
|
+
ProduceID: 'fde9a66f-ec6a-4aa8-bc13-15f5bebbbf28'
|
|
7
|
+
PropagateID: 'fde9a66f-ec6a-4aa8-bc13-15f5bebbbf28'
|
|
8
|
+
ReservedCode1: '8c413d0d-d05b-40eb-9650-e57940fcbacc'
|
|
9
|
+
ReservedCode2: '8c413d0d-d05b-40eb-9650-e57940fcbacc'
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# LModuleBox 组件说明
|
|
13
|
+
|
|
14
|
+
## 概述
|
|
15
|
+
|
|
16
|
+
`LModuleBox` 是一个参数化驱动的模块容器组件,采用类似 Element UI 的封装方式。用于展示带背景图、图标和标题的模块容器。所有样式(背景图、图标、标题文字等)均通过 props 参数动态控制。
|
|
17
|
+
|
|
18
|
+
## 核心特性
|
|
19
|
+
|
|
20
|
+
- ✅ **Props 驱动**:所有样式通过 props 参数控制,类似 Element UI
|
|
21
|
+
- ✅ **默认背景图和图标**:未传入时自动使用组件内置默认资源
|
|
22
|
+
- ✅ **高度灵活**:支持自定义背景图、图标、标题样式等
|
|
23
|
+
- ✅ **类型安全**:支持 String 和 Number 类型的尺寸参数
|
|
24
|
+
- ✅ **插槽支持**:支持默认插槽和 `headerBtn` 插槽
|
|
25
|
+
|
|
26
|
+
## 文件结构
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
l-module-box/
|
|
30
|
+
├── img/
|
|
31
|
+
│ ├── images.js # 图片映射文件
|
|
32
|
+
│ ├── l-module-box_icon.png # 默认图标
|
|
33
|
+
│ └── l-module-box_bg.png # 默认背景图
|
|
34
|
+
├── interface/
|
|
35
|
+
│ └── index.js # Props 定义(17个参数)
|
|
36
|
+
├── index.vue # 主组件(内联样式驱动)
|
|
37
|
+
└── README.md # 组件说明文档
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props 参数
|
|
41
|
+
|
|
42
|
+
### 基础数据
|
|
43
|
+
|
|
44
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
45
|
+
|--------|------|--------|------|
|
|
46
|
+
| `title` | String | `'中文标题'` | 显示的标题文字 |
|
|
47
|
+
|
|
48
|
+
### 背景图相关
|
|
49
|
+
|
|
50
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
51
|
+
|--------|------|--------|------|
|
|
52
|
+
| `bgImage` | String | `''` | 背景图图片URL(留空则使用默认背景图) |
|
|
53
|
+
| `bgWidth` | String/Number | `'432px'` | 背景图宽度 |
|
|
54
|
+
| `bgHeight` | String/Number | `'32px'` | 背景图高度 |
|
|
55
|
+
| `bgSize` | String | `'100% 100%'` | 背景图尺寸(缩放方式) |
|
|
56
|
+
| `bgPadding` | String | `'0 8px'` | 背景图内边距 |
|
|
57
|
+
|
|
58
|
+
### 图标相关
|
|
59
|
+
|
|
60
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
61
|
+
|--------|------|--------|------|
|
|
62
|
+
| `icon` | String | `''` | 图标图片URL(留空则使用默认图标) |
|
|
63
|
+
| `iconWidth` | String/Number | `'20px'` | 图标宽度 |
|
|
64
|
+
| `iconHeight` | String/Number | `'20px'` | 图标高度 |
|
|
65
|
+
| `iconGap` | String/Number | `'7px'` | 图标右边距(与标题的间距) |
|
|
66
|
+
|
|
67
|
+
### 标题文字相关
|
|
68
|
+
|
|
69
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
70
|
+
|--------|------|--------|------|
|
|
71
|
+
| `titleFontFamily` | String | `'YouSheBiaoTiHei'` | 标题字体 |
|
|
72
|
+
| `titleFontSize` | String/Number | `'20px'` | 标题字号 |
|
|
73
|
+
| `titleColor` | String | `'#FFFFFF'` | 标题颜色 |
|
|
74
|
+
| `titleLineHeight` | String/Number | `'26px'` | 标题行高 |
|
|
75
|
+
| `titleTextShadow` | String | `'0px 2px 4px rgba(0,0,0,0.5)'` | 标题文字阴影 |
|
|
76
|
+
|
|
77
|
+
### 按钮容器相关
|
|
78
|
+
|
|
79
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
80
|
+
|--------|------|--------|------|
|
|
81
|
+
| `btnContainerRight` | String/Number | `'8px'` | 按钮容器右边距 |
|
|
82
|
+
|
|
83
|
+
## 使用方式
|
|
84
|
+
|
|
85
|
+
### 基本使用
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<template>
|
|
89
|
+
<l-module-box title="文旅风险隐患监管">
|
|
90
|
+
<!-- 模块内容 -->
|
|
91
|
+
<div>内容区域</div>
|
|
92
|
+
</l-module-box>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script>
|
|
96
|
+
import LModuleBox from '@/components/moduleBox/l-module-box/index.vue'
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
components: {
|
|
100
|
+
LModuleBox
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 带按钮插槽
|
|
107
|
+
|
|
108
|
+
```vue
|
|
109
|
+
<template>
|
|
110
|
+
<l-module-box title="旅游投诉处理">
|
|
111
|
+
<template #headerBtn>
|
|
112
|
+
<el-button size="mini">重置</el-button>
|
|
113
|
+
</template>
|
|
114
|
+
<!-- 模块内容 -->
|
|
115
|
+
<div>内容区域</div>
|
|
116
|
+
</l-module-box>
|
|
117
|
+
</template>
|
|
118
|
+
|
|
119
|
+
<script>
|
|
120
|
+
import LModuleBox from '@/components/moduleBox/l-module-box/index.vue'
|
|
121
|
+
|
|
122
|
+
export default {
|
|
123
|
+
components: {
|
|
124
|
+
LModuleBox
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 自定义背景图和图标
|
|
131
|
+
|
|
132
|
+
```vue
|
|
133
|
+
<template>
|
|
134
|
+
<l-module-box
|
|
135
|
+
title="自定义模块"
|
|
136
|
+
:bgImage="require('@/assets/custom-bg.png')"
|
|
137
|
+
:icon="require('@/assets/custom-icon.png')"
|
|
138
|
+
:bgWidth="500"
|
|
139
|
+
:bgHeight="40"
|
|
140
|
+
>
|
|
141
|
+
<!-- 模块内容 -->
|
|
142
|
+
<div>内容区域</div>
|
|
143
|
+
</l-module-box>
|
|
144
|
+
</template>
|
|
145
|
+
|
|
146
|
+
<script>
|
|
147
|
+
import LModuleBox from '@/components/moduleBox/l-module-box/index.vue'
|
|
148
|
+
|
|
149
|
+
export default {
|
|
150
|
+
components: {
|
|
151
|
+
LModuleBox
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 完整自定义
|
|
158
|
+
|
|
159
|
+
```vue
|
|
160
|
+
<template>
|
|
161
|
+
<l-module-box
|
|
162
|
+
title="旅游服务"
|
|
163
|
+
:bgWidth="450"
|
|
164
|
+
:bgHeight="36"
|
|
165
|
+
:bgPadding="'0 10px'"
|
|
166
|
+
:iconWidth="24"
|
|
167
|
+
:iconHeight="24"
|
|
168
|
+
:iconGap="10"
|
|
169
|
+
:titleFontSize="22"
|
|
170
|
+
titleColor="#4CE27E"
|
|
171
|
+
:titleLineHeight="30"
|
|
172
|
+
:btnContainerRight="10"
|
|
173
|
+
>
|
|
174
|
+
<template #headerBtn>
|
|
175
|
+
<el-button size="mini" type="primary">操作</el-button>
|
|
176
|
+
</template>
|
|
177
|
+
<!-- 模块内容 -->
|
|
178
|
+
<div>内容区域</div>
|
|
179
|
+
</l-module-box>
|
|
180
|
+
</template>
|
|
181
|
+
|
|
182
|
+
<script>
|
|
183
|
+
import LModuleBox from '@/components/moduleBox/l-module-box/index.vue'
|
|
184
|
+
|
|
185
|
+
export default {
|
|
186
|
+
components: {
|
|
187
|
+
LModuleBox
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
</script>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 技术实现
|
|
194
|
+
|
|
195
|
+
### 内联样式生成
|
|
196
|
+
|
|
197
|
+
组件通过 computed 属性动态生成内联样式:
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
computed: {
|
|
201
|
+
headerStyle() {
|
|
202
|
+
return {
|
|
203
|
+
width: typeof this.bgWidth === 'number'
|
|
204
|
+
? `${this.bgWidth}px`
|
|
205
|
+
: this.bgWidth,
|
|
206
|
+
height: typeof this.bgHeight === 'number'
|
|
207
|
+
? `${this.bgHeight}px`
|
|
208
|
+
: this.bgHeight,
|
|
209
|
+
background: this.computedBgImage
|
|
210
|
+
? `url(${this.computedBgImage}) 0 0 no-repeat`
|
|
211
|
+
: '',
|
|
212
|
+
backgroundSize: this.bgSize
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 默认资源兜底
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
import { getIconPath, getBgPath } from './img/images'
|
|
222
|
+
|
|
223
|
+
computed: {
|
|
224
|
+
computedIcon() {
|
|
225
|
+
if (this.icon) {
|
|
226
|
+
return this.icon
|
|
227
|
+
}
|
|
228
|
+
// 使用默认图标
|
|
229
|
+
return getIconPath()
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
computedBgImage() {
|
|
233
|
+
if (this.bgImage) {
|
|
234
|
+
return this.bgImage
|
|
235
|
+
}
|
|
236
|
+
// 使用默认背景图
|
|
237
|
+
return getBgPath()
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 模板绑定
|
|
243
|
+
|
|
244
|
+
```vue
|
|
245
|
+
<template>
|
|
246
|
+
<div class="l-module-box">
|
|
247
|
+
<div @click="handleReset" class="l-module-box__header" :style="headerStyle">
|
|
248
|
+
<img class="l-module-box__icon" :src="computedIcon" :style="iconStyle" alt="">
|
|
249
|
+
<span class="l-module-box__text" :style="titleStyle">{{ title }}</span>
|
|
250
|
+
<div class="l-module-box__btn-container" :style="btnContainerStyle">
|
|
251
|
+
<slot name="headerBtn"></slot>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
<div class="l-module-box__main-slot">
|
|
255
|
+
<slot />
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</template>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 注意事项
|
|
262
|
+
|
|
263
|
+
1. **背景图和图标可选**:`bgImage` 和 `icon` 参数是可选的,未传入时使用默认资源
|
|
264
|
+
2. **尺寸单位**:Number 类型会自动添加 `px` 单位,String 类型需自行包含单位
|
|
265
|
+
3. **默认资源**:组件内置默认背景图和图标,位于 `img/` 目录下
|
|
266
|
+
4. **性能优化**:内联样式通过 computed 缓存,避免重复计算
|
|
267
|
+
5. **BEM 命名**:使用 `l-module-box__header`、`l-module-box__icon` 等 BEM 命名规范
|
|
268
|
+
6. **插槽支持**:支持默认插槽(模块内容)和 `headerBtn` 插槽(标题按钮)
|
|
269
|
+
|
|
270
|
+
## 适用场景
|
|
271
|
+
|
|
272
|
+
- ✅ 模块容器展示
|
|
273
|
+
- ✅ 带背景图和图标的标题展示
|
|
274
|
+
- ✅ 需要自定义样式和资源的场景
|
|
275
|
+
- ✅ 需要添加操作按钮的场景
|
|
276
|
+
|
|
277
|
+
## 更新日志
|
|
278
|
+
|
|
279
|
+
- **v1.0.0** (2026-06-18)
|
|
280
|
+
- 从 `ModuleBox` 重命名为 `l-module-box`
|
|
281
|
+
- 参考 `l-stat-card` 封装结构进行参数化重构
|
|
282
|
+
- 所有样式配置项抽离为 Props 参数
|
|
283
|
+
- 添加详细的字段注释说明
|
|
284
|
+
- 添加默认背景图和默认图标支持
|
|
285
|
+
- 支持背景图、图标、标题等所有样式自定义
|
|
286
|
+
- 使用内联样式实现(类似 Element UI)
|
|
287
|
+
- 支持默认插槽和 `headerBtn` 插槽
|
|
288
|
+
|
|
289
|
+
> AI生成
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LModuleBox 组件图片资源映射
|
|
3
|
+
* 提供默认图标和背景图的导出函数
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 预加载所有图片资源
|
|
7
|
+
const images = {
|
|
8
|
+
icon: require('./l-module-box_icon.png'),
|
|
9
|
+
bg: require('./l-module-box_bg.png')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 获取默认图标路径
|
|
14
|
+
* @returns {string} 图标路径
|
|
15
|
+
*/
|
|
16
|
+
export function getIconPath() {
|
|
17
|
+
return images.icon
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 获取默认背景图路径
|
|
22
|
+
* @returns {string} 背景图路径
|
|
23
|
+
*/
|
|
24
|
+
export function getBgPath() {
|
|
25
|
+
return images.bg
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default images
|
|
Binary file
|
|
Binary file
|