@ebiz/designer-components 0.0.18-beta.1 → 0.0.18-beta.3
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/dist/designer-components.css +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.mjs +118984 -0
- package/package.json +1 -1
- package/src/components/EbizAvatar.vue +116 -0
- package/src/components/EbizEmployeeInfo.vue +139 -0
- package/src/components/EbizStatistic.vue +150 -0
- package/src/components/EbizTabPanel.vue +23 -0
- package/src/components/EbizTabs.vue +143 -0
- package/src/components/EbizTitle.vue +37 -36
- package/src/components/TdesignAlert.vue +116 -0
- package/src/components/TdesignTimeline.vue +58 -0
- package/src/components/TdesignTimelineItem.vue +72 -0
- package/src/components/TdesignWatermark.vue +108 -0
- package/src/index.js +31 -0
- package/src/router/index.js +42 -0
- package/src/views/EbizAvatar.vue +224 -0
- package/src/views/EbizEmployeeInfo.vue +250 -0
- package/src/views/Home.vue +8 -1
- package/src/views/StatisticDemo.vue +191 -0
- package/src/views/TabsDemo.vue +283 -0
- package/src/views/TdesignAlert.vue +99 -0
- package/src/views/TimelineDemo.vue +161 -0
- package/src/views/WatermarkDemo.vue +86 -0
package/package.json
CHANGED
@@ -0,0 +1,116 @@
|
|
1
|
+
<template>
|
2
|
+
<t-avatar
|
3
|
+
:alt="alt"
|
4
|
+
:badge-props="badgeProps"
|
5
|
+
:content="content"
|
6
|
+
:hide-on-load-error="hideOnLoadError"
|
7
|
+
:image="image"
|
8
|
+
:image-props="imageProps"
|
9
|
+
:shape="shape"
|
10
|
+
:size="size"
|
11
|
+
:style="customStyle"
|
12
|
+
@error="handleError"
|
13
|
+
>
|
14
|
+
<!-- 图标插槽 -->
|
15
|
+
<template v-if="$slots.icon" #icon>
|
16
|
+
<slot name="icon"></slot>
|
17
|
+
</template>
|
18
|
+
|
19
|
+
<!-- 内容插槽 -->
|
20
|
+
<template v-if="$slots.content" #content>
|
21
|
+
<slot name="content"></slot>
|
22
|
+
</template>
|
23
|
+
|
24
|
+
<!-- 默认插槽 -->
|
25
|
+
<slot>{{ content }}</slot>
|
26
|
+
</t-avatar>
|
27
|
+
</template>
|
28
|
+
|
29
|
+
<script>
|
30
|
+
export default {
|
31
|
+
name: "EbizAvatar"
|
32
|
+
}
|
33
|
+
</script>
|
34
|
+
|
35
|
+
<script setup>
|
36
|
+
import { defineProps, defineEmits, computed } from 'vue';
|
37
|
+
import { Avatar as TAvatar } from 'tdesign-vue-next';
|
38
|
+
|
39
|
+
const props = defineProps({
|
40
|
+
// 头像替代文本
|
41
|
+
alt: {
|
42
|
+
type: String,
|
43
|
+
default: ''
|
44
|
+
},
|
45
|
+
// 徽标属性
|
46
|
+
badgeProps: {
|
47
|
+
type: Object,
|
48
|
+
default: () => ({})
|
49
|
+
},
|
50
|
+
// 头像内容
|
51
|
+
content: {
|
52
|
+
type: [String, Function],
|
53
|
+
default: ''
|
54
|
+
},
|
55
|
+
// 图片加载失败时是否隐藏
|
56
|
+
hideOnLoadError: {
|
57
|
+
type: Boolean,
|
58
|
+
default: false
|
59
|
+
},
|
60
|
+
// 头像图片地址
|
61
|
+
image: {
|
62
|
+
type: String,
|
63
|
+
default: ''
|
64
|
+
},
|
65
|
+
// 图片属性
|
66
|
+
imageProps: {
|
67
|
+
type: Object,
|
68
|
+
default: () => ({})
|
69
|
+
},
|
70
|
+
// 头像形状
|
71
|
+
shape: {
|
72
|
+
type: String,
|
73
|
+
default: 'circle',
|
74
|
+
validator: (val) => ['circle', 'round'].includes(val)
|
75
|
+
},
|
76
|
+
// 头像尺寸
|
77
|
+
size: {
|
78
|
+
type: String,
|
79
|
+
default: 'medium',
|
80
|
+
validator: (val) => ['small', 'medium', 'large'].includes(val) || /^(\d+px|\d+em|\d+rem|\d+%)$/.test(val)
|
81
|
+
},
|
82
|
+
// 自定义宽度
|
83
|
+
width: {
|
84
|
+
type: [String, Number],
|
85
|
+
default: ''
|
86
|
+
},
|
87
|
+
// 自定义高度
|
88
|
+
height: {
|
89
|
+
type: [String, Number],
|
90
|
+
default: ''
|
91
|
+
}
|
92
|
+
});
|
93
|
+
|
94
|
+
const emit = defineEmits(['error']);
|
95
|
+
|
96
|
+
// 处理图片加载错误事件
|
97
|
+
const handleError = (context) => {
|
98
|
+
emit('error', context);
|
99
|
+
};
|
100
|
+
|
101
|
+
// 计算样式
|
102
|
+
const customStyle = computed(() => {
|
103
|
+
const style = {};
|
104
|
+
if (props.width) {
|
105
|
+
style.width = typeof props.width === 'number' ? `${props.width}px` : props.width;
|
106
|
+
}
|
107
|
+
if (props.height) {
|
108
|
+
style.height = typeof props.height === 'number' ? `${props.height}px` : props.height;
|
109
|
+
}
|
110
|
+
return style;
|
111
|
+
});
|
112
|
+
</script>
|
113
|
+
|
114
|
+
<style lang="less" scoped>
|
115
|
+
/* 自定义样式 */
|
116
|
+
</style>
|
@@ -0,0 +1,139 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="ebiz-employee-info" :style="customStyle">
|
3
|
+
<div class="employee-avatar">
|
4
|
+
<ebiz-avatar
|
5
|
+
:image="employeeInfo.avatar"
|
6
|
+
:content="avatarContent"
|
7
|
+
:size="avatarSize"
|
8
|
+
:shape="avatarShape"
|
9
|
+
:alt="employeeInfo.name"
|
10
|
+
@error="handleAvatarError"
|
11
|
+
/>
|
12
|
+
</div>
|
13
|
+
<div class="employee-details">
|
14
|
+
<div class="employee-name">{{ employeeInfo.name }}</div>
|
15
|
+
<div class="employee-id" v-if="employeeInfo.id">ID: {{ employeeInfo.id }}</div>
|
16
|
+
<div class="employee-department" v-if="employeeInfo.department">{{ employeeInfo.department }}</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</template>
|
20
|
+
|
21
|
+
<script>
|
22
|
+
export default {
|
23
|
+
name: "EbizEmployeeInfo"
|
24
|
+
}
|
25
|
+
</script>
|
26
|
+
|
27
|
+
<script setup>
|
28
|
+
import { computed, defineProps, defineEmits } from 'vue';
|
29
|
+
import EbizAvatar from './EbizAvatar.vue';
|
30
|
+
|
31
|
+
const props = defineProps({
|
32
|
+
// 员工信息对象,包含头像、名称、工号、部门
|
33
|
+
info: {
|
34
|
+
type: Object,
|
35
|
+
required: true,
|
36
|
+
default: () => ({
|
37
|
+
avatar: '',
|
38
|
+
name: '',
|
39
|
+
id: '',
|
40
|
+
department: ''
|
41
|
+
})
|
42
|
+
},
|
43
|
+
// 头像尺寸
|
44
|
+
avatarSize: {
|
45
|
+
type: String,
|
46
|
+
default: 'medium',
|
47
|
+
validator: (val) => ['small', 'medium', 'large'].includes(val) || /^(\d+px|\d+em|\d+rem|\d+%)$/.test(val)
|
48
|
+
},
|
49
|
+
// 头像形状
|
50
|
+
avatarShape: {
|
51
|
+
type: String,
|
52
|
+
default: 'circle',
|
53
|
+
validator: (val) => ['circle', 'round'].includes(val)
|
54
|
+
},
|
55
|
+
// 自定义宽度
|
56
|
+
width: {
|
57
|
+
type: [String, Number],
|
58
|
+
default: ''
|
59
|
+
},
|
60
|
+
// 自定义高度
|
61
|
+
height: {
|
62
|
+
type: [String, Number],
|
63
|
+
default: ''
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
const emit = defineEmits(['avatar-error']);
|
68
|
+
|
69
|
+
// 从props获取员工信息,提供默认值
|
70
|
+
const employeeInfo = computed(() => {
|
71
|
+
return {
|
72
|
+
avatar: props.info.avatar || '',
|
73
|
+
name: props.info.name || '未知',
|
74
|
+
id: props.info.id || '',
|
75
|
+
department: props.info.department || ''
|
76
|
+
};
|
77
|
+
});
|
78
|
+
|
79
|
+
// 生成头像内容(当没有提供头像图片时使用员工姓名首字母)
|
80
|
+
const avatarContent = computed(() => {
|
81
|
+
if (employeeInfo.value.name) {
|
82
|
+
return employeeInfo.value.name.charAt(0);
|
83
|
+
}
|
84
|
+
return '';
|
85
|
+
});
|
86
|
+
|
87
|
+
// 处理头像加载错误
|
88
|
+
const handleAvatarError = (context) => {
|
89
|
+
emit('avatar-error', context);
|
90
|
+
};
|
91
|
+
|
92
|
+
// 计算自定义样式
|
93
|
+
const customStyle = computed(() => {
|
94
|
+
const style = {};
|
95
|
+
if (props.width) {
|
96
|
+
style.width = typeof props.width === 'number' ? `${props.width}px` : props.width;
|
97
|
+
}
|
98
|
+
if (props.height) {
|
99
|
+
style.height = typeof props.height === 'number' ? `${props.height}px` : props.height;
|
100
|
+
}
|
101
|
+
return style;
|
102
|
+
});
|
103
|
+
</script>
|
104
|
+
|
105
|
+
<style lang="less" scoped>
|
106
|
+
.ebiz-employee-info {
|
107
|
+
display: flex;
|
108
|
+
align-items: center;
|
109
|
+
|
110
|
+
.employee-avatar {
|
111
|
+
margin-right: 16px;
|
112
|
+
}
|
113
|
+
|
114
|
+
.employee-details {
|
115
|
+
flex: 1;
|
116
|
+
display: flex;
|
117
|
+
flex-direction: column;
|
118
|
+
justify-content: center;
|
119
|
+
}
|
120
|
+
|
121
|
+
.employee-name {
|
122
|
+
font-size: 16px;
|
123
|
+
font-weight: 600;
|
124
|
+
color: #333;
|
125
|
+
margin-bottom: 4px;
|
126
|
+
}
|
127
|
+
|
128
|
+
.employee-id {
|
129
|
+
font-size: 13px;
|
130
|
+
color: #666;
|
131
|
+
margin-bottom: 2px;
|
132
|
+
}
|
133
|
+
|
134
|
+
.employee-department {
|
135
|
+
font-size: 13px;
|
136
|
+
color: #666;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
</style>
|
@@ -0,0 +1,150 @@
|
|
1
|
+
<template>
|
2
|
+
<t-statistic
|
3
|
+
ref="statisticRef"
|
4
|
+
:animation="animation"
|
5
|
+
:animation-start="animationStart"
|
6
|
+
:color="color"
|
7
|
+
:decimalPlaces="decimalPlaces"
|
8
|
+
:loading="loading"
|
9
|
+
:prefix="prefix"
|
10
|
+
:suffix="suffix"
|
11
|
+
:title="title"
|
12
|
+
:trend="trend"
|
13
|
+
:trend-placement="trendPlacement"
|
14
|
+
:unit="unit"
|
15
|
+
:value="value"
|
16
|
+
@click="handleClick"
|
17
|
+
>
|
18
|
+
<!-- 加载中状态插槽 -->
|
19
|
+
<template v-if="$slots.loading" #loading>
|
20
|
+
<slot name="loading"></slot>
|
21
|
+
</template>
|
22
|
+
|
23
|
+
<!-- 前缀插槽 -->
|
24
|
+
<template v-if="$slots.prefix" #prefix>
|
25
|
+
<slot name="prefix"></slot>
|
26
|
+
</template>
|
27
|
+
|
28
|
+
<!-- 后缀插槽 -->
|
29
|
+
<template v-if="$slots.suffix" #suffix>
|
30
|
+
<slot name="suffix"></slot>
|
31
|
+
</template>
|
32
|
+
|
33
|
+
<!-- 标题插槽 -->
|
34
|
+
<template v-if="$slots.title" #title>
|
35
|
+
<slot name="title"></slot>
|
36
|
+
</template>
|
37
|
+
|
38
|
+
<!-- 趋势插槽 -->
|
39
|
+
<template v-if="$slots.trend" #trend>
|
40
|
+
<slot name="trend"></slot>
|
41
|
+
</template>
|
42
|
+
|
43
|
+
<!-- 单位插槽 -->
|
44
|
+
<template v-if="$slots.unit" #unit>
|
45
|
+
<slot name="unit"></slot>
|
46
|
+
</template>
|
47
|
+
|
48
|
+
<!-- 默认插槽 -->
|
49
|
+
<slot></slot>
|
50
|
+
</t-statistic>
|
51
|
+
</template>
|
52
|
+
|
53
|
+
<script>
|
54
|
+
export default {
|
55
|
+
name: "EbizStatistic"
|
56
|
+
}
|
57
|
+
</script>
|
58
|
+
|
59
|
+
<script setup>
|
60
|
+
import { defineProps, defineEmits, ref, onMounted } from 'vue';
|
61
|
+
import { Statistic as TStatistic } from 'tdesign-vue-next';
|
62
|
+
|
63
|
+
const props = defineProps({
|
64
|
+
// 数值动画配置
|
65
|
+
animation: {
|
66
|
+
type: Object,
|
67
|
+
default: () => ({}),
|
68
|
+
},
|
69
|
+
// 数值动画开始时间,单位:毫秒
|
70
|
+
animationStart: {
|
71
|
+
type: Boolean,
|
72
|
+
default: false,
|
73
|
+
},
|
74
|
+
// 颜色
|
75
|
+
color: {
|
76
|
+
type: String,
|
77
|
+
default: '',
|
78
|
+
},
|
79
|
+
// 小数位数
|
80
|
+
decimalPlaces: {
|
81
|
+
type: Number,
|
82
|
+
default: 0,
|
83
|
+
},
|
84
|
+
// 加载中状态
|
85
|
+
loading: {
|
86
|
+
type: Boolean,
|
87
|
+
default: false,
|
88
|
+
},
|
89
|
+
// 前缀内容
|
90
|
+
prefix: {
|
91
|
+
type: [String, Function],
|
92
|
+
default: '',
|
93
|
+
},
|
94
|
+
// 后缀内容
|
95
|
+
suffix: {
|
96
|
+
type: [String, Function],
|
97
|
+
default: '',
|
98
|
+
},
|
99
|
+
// 数值显示的标题
|
100
|
+
title: {
|
101
|
+
type: [String, Function],
|
102
|
+
default: '',
|
103
|
+
},
|
104
|
+
// 趋势
|
105
|
+
trend: {
|
106
|
+
type: String,
|
107
|
+
default: '',
|
108
|
+
validator: (val) => ['', 'increase', 'decrease'].includes(val)
|
109
|
+
},
|
110
|
+
// 趋势展示位置
|
111
|
+
trendPlacement: {
|
112
|
+
type: String,
|
113
|
+
default: 'left',
|
114
|
+
validator: (val) => ['left', 'right'].includes(val)
|
115
|
+
},
|
116
|
+
// 单位内容
|
117
|
+
unit: {
|
118
|
+
type: [String, Function],
|
119
|
+
default: '',
|
120
|
+
},
|
121
|
+
// 数值
|
122
|
+
value: {
|
123
|
+
type: Number,
|
124
|
+
default: 0,
|
125
|
+
},
|
126
|
+
});
|
127
|
+
|
128
|
+
const emit = defineEmits(['click']);
|
129
|
+
|
130
|
+
// 引用实例,用于调用组件的start方法
|
131
|
+
const statisticRef = ref(null);
|
132
|
+
|
133
|
+
// 点击事件
|
134
|
+
const handleClick = (e) => {
|
135
|
+
emit('click', e);
|
136
|
+
};
|
137
|
+
|
138
|
+
// 暴露start方法,用于手动开始动画
|
139
|
+
defineExpose({
|
140
|
+
start: () => {
|
141
|
+
if (statisticRef.value) {
|
142
|
+
statisticRef.value.start();
|
143
|
+
}
|
144
|
+
}
|
145
|
+
});
|
146
|
+
</script>
|
147
|
+
|
148
|
+
<style lang="less" scoped>
|
149
|
+
/* 自定义样式 */
|
150
|
+
</style>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<template>
|
2
|
+
<tab-panel
|
3
|
+
:value="value"
|
4
|
+
:label="label"
|
5
|
+
:disabled="disabled"
|
6
|
+
:removable="removable"
|
7
|
+
:destroyOnHide="destroyOnHide"
|
8
|
+
:draggable="draggable"
|
9
|
+
@remove="handleRemove"
|
10
|
+
>
|
11
|
+
<slot></slot>
|
12
|
+
</tab-panel>
|
13
|
+
</template>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
import { TabPanel } from 'tdesign-vue-next';
|
17
|
+
|
18
|
+
export default TabPanel;
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<style lang="less" scoped>
|
22
|
+
/* 自定义样式 */
|
23
|
+
</style>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="tdesign-tabs-wrapper">
|
3
|
+
<t-tabs
|
4
|
+
v-model="innerValue"
|
5
|
+
:addable="addable"
|
6
|
+
:disabled="disabled"
|
7
|
+
:placement="placement"
|
8
|
+
:size="size"
|
9
|
+
:theme="theme"
|
10
|
+
:list="list"
|
11
|
+
:dragSort="dragSort"
|
12
|
+
@add="handleAdd"
|
13
|
+
@change="handleChange"
|
14
|
+
@dragSort="handleDragSort"
|
15
|
+
@remove="handleRemove"
|
16
|
+
>
|
17
|
+
<!-- 添加按钮插槽 -->
|
18
|
+
<template v-if="$slots.action" #action>
|
19
|
+
<slot name="action"></slot>
|
20
|
+
</template>
|
21
|
+
|
22
|
+
<!-- 直接输出默认插槽内容,这里应该只包含EbizTabPanel -->
|
23
|
+
<slot></slot>
|
24
|
+
</t-tabs>
|
25
|
+
</div>
|
26
|
+
</template>
|
27
|
+
|
28
|
+
<script>
|
29
|
+
import { Tabs as TTabs } from 'tdesign-vue-next';
|
30
|
+
import { defineComponent, toRefs, computed, watch } from 'vue';
|
31
|
+
|
32
|
+
export default defineComponent({
|
33
|
+
name: 'EbizTabs',
|
34
|
+
components: {
|
35
|
+
't-tabs': TTabs,
|
36
|
+
},
|
37
|
+
props: {
|
38
|
+
// v-model绑定值
|
39
|
+
modelValue: {
|
40
|
+
type: [String, Number],
|
41
|
+
},
|
42
|
+
// 默认值
|
43
|
+
defaultValue: {
|
44
|
+
type: [String, Number],
|
45
|
+
},
|
46
|
+
// 选项卡右侧的操作区域
|
47
|
+
action: {
|
48
|
+
type: [Function, String],
|
49
|
+
default: undefined
|
50
|
+
},
|
51
|
+
// 选项卡是否可增加
|
52
|
+
addable: {
|
53
|
+
type: Boolean,
|
54
|
+
default: false
|
55
|
+
},
|
56
|
+
// 是否禁用选项卡
|
57
|
+
disabled: {
|
58
|
+
type: Boolean,
|
59
|
+
default: false
|
60
|
+
},
|
61
|
+
// 是否开启拖拽调整顺序
|
62
|
+
dragSort: {
|
63
|
+
type: Boolean,
|
64
|
+
default: false
|
65
|
+
},
|
66
|
+
// 选项卡列表
|
67
|
+
list: {
|
68
|
+
type: Array,
|
69
|
+
},
|
70
|
+
// 选项卡位置
|
71
|
+
placement: {
|
72
|
+
type: String,
|
73
|
+
default: 'top',
|
74
|
+
validator: (val) => ['top', 'bottom', 'left', 'right'].includes(val)
|
75
|
+
},
|
76
|
+
// 组件尺寸
|
77
|
+
size: {
|
78
|
+
type: String,
|
79
|
+
default: 'medium',
|
80
|
+
validator: (val) => ['medium', 'large'].includes(val)
|
81
|
+
},
|
82
|
+
// 选项卡风格
|
83
|
+
theme: {
|
84
|
+
type: String,
|
85
|
+
default: 'normal',
|
86
|
+
validator: (val) => ['normal', 'card'].includes(val)
|
87
|
+
}
|
88
|
+
},
|
89
|
+
emits: ['update:modelValue', 'add', 'change', 'dragSort', 'remove'],
|
90
|
+
setup(props, { emit }) {
|
91
|
+
const { modelValue, defaultValue } = toRefs(props);
|
92
|
+
|
93
|
+
// 内部值计算属性,用于双向绑定
|
94
|
+
const innerValue = computed({
|
95
|
+
get: () => modelValue.value !== undefined ? modelValue.value : defaultValue.value,
|
96
|
+
set: (val) => {
|
97
|
+
emit('update:modelValue', val);
|
98
|
+
}
|
99
|
+
});
|
100
|
+
|
101
|
+
// 监听modelValue变化
|
102
|
+
watch(modelValue, (newVal) => {
|
103
|
+
if (newVal !== innerValue.value) {
|
104
|
+
innerValue.value = newVal;
|
105
|
+
}
|
106
|
+
});
|
107
|
+
|
108
|
+
// 添加选项卡事件
|
109
|
+
const handleAdd = (context) => {
|
110
|
+
emit('add', context);
|
111
|
+
};
|
112
|
+
|
113
|
+
// 选项卡切换事件
|
114
|
+
const handleChange = (value, context) => {
|
115
|
+
emit('change', value, context);
|
116
|
+
};
|
117
|
+
|
118
|
+
// 拖拽排序事件
|
119
|
+
const handleDragSort = (context) => {
|
120
|
+
emit('dragSort', context);
|
121
|
+
};
|
122
|
+
|
123
|
+
// 删除选项卡事件
|
124
|
+
const handleRemove = (options) => {
|
125
|
+
emit('remove', options);
|
126
|
+
};
|
127
|
+
|
128
|
+
return {
|
129
|
+
innerValue,
|
130
|
+
handleAdd,
|
131
|
+
handleChange,
|
132
|
+
handleDragSort,
|
133
|
+
handleRemove
|
134
|
+
};
|
135
|
+
}
|
136
|
+
});
|
137
|
+
</script>
|
138
|
+
|
139
|
+
<style lang="less" scoped>
|
140
|
+
.tdesign-tabs-wrapper {
|
141
|
+
width: 100%;
|
142
|
+
}
|
143
|
+
</style>
|
@@ -1,51 +1,52 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="ebiz-title">
|
3
|
-
<div class="color-block" :style="{ backgroundColor: color, width: `${blockWidth}px` }"></div>
|
4
|
-
<div class="title-text">
|
3
|
+
<!-- <div class="color-block" :style="{ backgroundColor: color, width: `${blockWidth}px` }"></div> -->
|
4
|
+
<!-- <div class="title-text">
|
5
5
|
<slot name="title">
|
6
6
|
{{ displayTitle }}
|
7
7
|
</slot>
|
8
|
-
</div>
|
8
|
+
</div> -->
|
9
9
|
</div>
|
10
10
|
</template>
|
11
11
|
|
12
12
|
<script setup>
|
13
|
-
import { defineProps, computed } from 'vue';
|
14
13
|
|
15
|
-
|
16
|
-
* EbizTitle 组件 - 带有色块的标题组件
|
17
|
-
* 支持自定义标题文本、色块颜色和色块宽度
|
18
|
-
* 包含一个按钮,点击时在标题后添加点号并触发事件
|
19
|
-
* 支持通过插槽自定义标题内容
|
20
|
-
*/
|
21
|
-
const props = defineProps({
|
22
|
-
/**
|
23
|
-
* 标题文本 (当不使用插槽时显示)
|
24
|
-
*/
|
25
|
-
title: {
|
26
|
-
type: String,
|
27
|
-
default: '标题'
|
28
|
-
},
|
29
|
-
/**
|
30
|
-
* 色块颜色,支持任何有效的CSS颜色值
|
31
|
-
*/
|
32
|
-
color: {
|
33
|
-
type: String,
|
34
|
-
default: '#1890ff'
|
35
|
-
},
|
36
|
-
/**
|
37
|
-
* 色块宽度,单位为像素
|
38
|
-
*/
|
39
|
-
blockWidth: {
|
40
|
-
type: Number,
|
41
|
-
default: 10
|
42
|
-
}
|
43
|
-
});
|
14
|
+
// import { defineProps, computed } from 'vue';
|
44
15
|
|
16
|
+
// /**
|
17
|
+
// * EbizTitle 组件 - 带有色块的标题组件
|
18
|
+
// * 支持自定义标题文本、色块颜色和色块宽度
|
19
|
+
// * 包含一个按钮,点击时在标题后添加点号并触发事件
|
20
|
+
// * 支持通过插槽自定义标题内容
|
21
|
+
// */
|
22
|
+
// const props = defineProps({
|
23
|
+
// /**
|
24
|
+
// * 标题文本 (当不使用插槽时显示)
|
25
|
+
// */
|
26
|
+
// title: {
|
27
|
+
// type: String,
|
28
|
+
// default: '标题'
|
29
|
+
// },
|
30
|
+
// /**
|
31
|
+
// * 色块颜色,支持任何有效的CSS颜色值
|
32
|
+
// */
|
33
|
+
// color: {
|
34
|
+
// type: String,
|
35
|
+
// default: '#1890ff'
|
36
|
+
// },
|
37
|
+
// /**
|
38
|
+
// * 色块宽度,单位为像素
|
39
|
+
// */
|
40
|
+
// blockWidth: {
|
41
|
+
// type: Number,
|
42
|
+
// default: 10
|
43
|
+
// }
|
44
|
+
// });
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
// // // 计算属性:根据点号数量生成显示的标题
|
47
|
+
// const displayTitle = computed(() => {
|
48
|
+
// return props.title;
|
49
|
+
// });
|
49
50
|
</script>
|
50
51
|
|
51
52
|
<style scoped>
|