@ebiz/designer-components 0.0.18 → 0.0.19
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/package.json +3 -2
- package/src/apiService/mockDataService.js +116 -0
- package/src/apiService/simpleDataService.js +186 -80
- package/src/components/Button.vue +72 -22
- package/src/components/EbizAvatar.vue +116 -0
- package/src/components/EbizCheckbox.vue +94 -0
- package/src/components/EbizCheckboxGroup.vue +70 -0
- package/src/components/EbizDetailBlock.vue +82 -0
- package/src/components/EbizDialog.vue +244 -56
- package/src/components/EbizEmployeeInfo.vue +139 -0
- package/src/components/EbizFileUpload.vue +202 -0
- package/src/components/EbizPageHeader.vue +96 -0
- package/src/components/EbizPagination.vue +163 -0
- package/src/components/EbizRadio.vue +87 -0
- package/src/components/EbizRadioGroup.vue +84 -0
- package/src/components/EbizRemoteSelect.vue +118 -40
- package/src/components/EbizSpace.vue +101 -0
- package/src/components/EbizStatistic.vue +150 -0
- package/src/components/EbizSwiper.vue +114 -0
- package/src/components/EbizSwiperItem.vue +14 -0
- package/src/components/EbizSwitch.vue +86 -0
- package/src/components/EbizTabHeader.vue +145 -0
- package/src/components/EbizTabPanel.vue +23 -0
- package/src/components/EbizTable.vue +466 -0
- package/src/components/EbizTableColumn.vue +117 -0
- package/src/components/EbizTableSort.vue +181 -0
- package/src/components/EbizTabs.vue +133 -91
- package/src/components/EbizTimePicker.vue +144 -0
- package/src/components/EbizTitle.vue +3 -10
- package/src/components/EbizTree.vue +153 -0
- package/src/components/EbizTreeSelector.vue +423 -0
- package/src/components/Home.vue +8 -0
- package/src/components/TdesignAlert.vue +116 -0
- package/src/components/TdesignButton.vue +130 -0
- package/src/components/TdesignCalendar/index.vue +146 -0
- package/src/components/TdesignCard.vue +196 -0
- package/src/components/TdesignCol.vue +102 -0
- package/src/components/TdesignCollapse.vue +143 -0
- package/src/components/TdesignCollapsePanel.vue +80 -0
- package/src/components/TdesignDatePicker.vue +125 -0
- package/src/components/TdesignDialog.vue +226 -0
- package/src/components/TdesignForm.vue +134 -0
- package/src/components/TdesignFormItem.vue +106 -0
- package/src/components/TdesignGrid.vue +56 -0
- package/src/components/TdesignIcon.vue +68 -0
- package/src/components/TdesignImage.vue +163 -0
- package/src/components/TdesignImageViewer.vue +201 -0
- package/src/components/TdesignInput.vue +243 -0
- package/src/components/TdesignSelect.vue +445 -0
- package/src/components/TdesignTag.vue +118 -0
- package/src/components/TdesignTextarea.vue +143 -0
- package/src/components/TdesignTimeline.vue +58 -0
- package/src/components/TdesignTimelineItem.vue +72 -0
- package/src/components/TdesignUpload.vue +757 -0
- package/src/components/TdesignWatermark.vue +108 -0
- package/src/index.js +130 -0
- package/src/main.js +20 -4
- package/src/router/index.js +244 -5
- package/src/views/Button.vue +7 -3
- package/src/views/CheckboxDemo.vue +105 -0
- package/src/views/DialogDemo.vue +126 -0
- package/src/views/EbizAvatar.vue +224 -0
- package/src/views/EbizDetailBlockDemo.vue +31 -0
- package/src/views/EbizEmployeeInfo.vue +250 -0
- package/src/views/EbizRadioDemo.vue +152 -0
- package/src/views/EbizSpace.vue +186 -0
- package/src/views/EbizSwiper.vue +158 -0
- package/src/views/GridDemo.vue +239 -0
- package/src/views/Home.vue +63 -2
- package/src/views/PageHeaderDemo.vue +105 -0
- package/src/views/PaginationDemo.vue +97 -0
- package/src/views/RemoteSelect.vue +336 -5
- package/src/views/StatisticDemo.vue +191 -0
- package/src/views/SwitchDemo.vue +80 -0
- package/src/views/TableDemo.vue +335 -0
- package/src/views/TableSortDemo.vue +144 -0
- package/src/views/TableView.vue +69 -0
- package/src/views/TabsDemo.vue +283 -0
- package/src/views/TagDemo.vue +102 -0
- package/src/views/TdesignAlert.vue +99 -0
- package/src/views/TdesignButton.vue +191 -0
- package/src/views/TdesignCalendar.vue +95 -0
- package/src/views/TdesignCard.vue +297 -0
- package/src/views/TdesignCollapse.vue +294 -0
- package/src/views/TdesignDatePicker.vue +188 -0
- package/src/views/TdesignForm.vue +249 -0
- package/src/views/TdesignIcon.vue +204 -0
- package/src/views/TdesignImage.vue +216 -0
- package/src/views/TdesignImageViewer.vue +199 -0
- package/src/views/TdesignInput.vue +253 -0
- package/src/views/TdesignSelect.vue +474 -0
- package/src/views/TdesignSwiper.vue +158 -0
- package/src/views/TextareaDemo.vue +94 -0
- package/src/views/TimePickerDemo.vue +147 -0
- package/src/views/TimelineDemo.vue +161 -0
- package/src/views/TreeDemo.vue +255 -0
- package/src/views/TreeSelectorDemo.vue +246 -0
- package/src/views/UploadDemo.vue +122 -0
- package/src/views/WatermarkDemo.vue +86 -0
@@ -0,0 +1,216 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="container">
|
3
|
+
<h1>TDesign 图片组件示例</h1>
|
4
|
+
|
5
|
+
<div class="section">
|
6
|
+
<h2>基础用法</h2>
|
7
|
+
<div class="example-block">
|
8
|
+
<t-image src="https://tdesign.tencent.com/vue-next/assets/image1.jpg" :style="{ width: '100px', height: '100px' }" />
|
9
|
+
</div>
|
10
|
+
<div class="code-block">
|
11
|
+
<pre><code><t-image src="https://tdesign.tencent.com/vue-next/assets/image1.jpg" :style="{ width: '100px', height: '100px' }" /></code></pre>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="section">
|
16
|
+
<h2>不同填充模式</h2>
|
17
|
+
<div class="example-block image-fit-container">
|
18
|
+
<div v-for="fit in fitList" :key="fit" class="image-fit-item">
|
19
|
+
<t-image
|
20
|
+
:style="{ width: '100px', height: '100px' }"
|
21
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
22
|
+
:fit="fit"
|
23
|
+
/>
|
24
|
+
<div class="image-fit-text">fit: {{ fit }}</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<div class="code-block">
|
28
|
+
<pre><code>// 可选值: fill(默认), contain, cover, none, scale-down
|
29
|
+
<t-image
|
30
|
+
:style="{ width: '100px', height: '100px' }"
|
31
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
32
|
+
fit="cover"
|
33
|
+
/></code></pre>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="section">
|
38
|
+
<h2>不同形状</h2>
|
39
|
+
<div class="example-block">
|
40
|
+
<div v-for="shape in shapeList" :key="shape" class="image-shape-item">
|
41
|
+
<t-image
|
42
|
+
:style="{ width: '100px', height: '100px' }"
|
43
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
44
|
+
:shape="shape"
|
45
|
+
/>
|
46
|
+
<div class="image-shape-text">shape: {{ shape }}</div>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
<div class="code-block">
|
50
|
+
<pre><code>// 可选值: square(默认), circle, round
|
51
|
+
<t-image
|
52
|
+
:style="{ width: '100px', height: '100px' }"
|
53
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
54
|
+
shape="circle"
|
55
|
+
/></code></pre>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<div class="section">
|
60
|
+
<h2>图片加载状态</h2>
|
61
|
+
<div class="example-block">
|
62
|
+
<t-image
|
63
|
+
:style="{ width: '100px', height: '100px' }"
|
64
|
+
src="https://tdesign.tencent.com/vue-next/assets/image-error.jpg"
|
65
|
+
:error="'加载失败'"
|
66
|
+
:loading="'加载中...'"
|
67
|
+
/>
|
68
|
+
</div>
|
69
|
+
<div class="code-block">
|
70
|
+
<pre><code><t-image
|
71
|
+
:style="{ width: '100px', height: '100px' }"
|
72
|
+
src="https://tdesign.tencent.com/vue-next/assets/image-error.jpg"
|
73
|
+
:error="'加载失败'"
|
74
|
+
:loading="'加载中...'"
|
75
|
+
/></code></pre>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="section">
|
80
|
+
<h2>图片懒加载</h2>
|
81
|
+
<div class="example-block">
|
82
|
+
<t-image
|
83
|
+
:style="{ width: '100px', height: '100px' }"
|
84
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
85
|
+
:lazy="true"
|
86
|
+
/>
|
87
|
+
</div>
|
88
|
+
<div class="code-block">
|
89
|
+
<pre><code><t-image
|
90
|
+
:style="{ width: '100px', height: '100px' }"
|
91
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
92
|
+
:lazy="true"
|
93
|
+
/></code></pre>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
<div class="section">
|
98
|
+
<h2>图片上展示悬浮内容</h2>
|
99
|
+
<div class="example-block">
|
100
|
+
<t-image
|
101
|
+
:style="{ width: '100px', height: '100px' }"
|
102
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
103
|
+
:overlay-content="'悬浮内容'"
|
104
|
+
overlay-trigger="hover"
|
105
|
+
/>
|
106
|
+
</div>
|
107
|
+
<div class="code-block">
|
108
|
+
<pre><code><t-image
|
109
|
+
:style="{ width: '100px', height: '100px' }"
|
110
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
111
|
+
:overlay-content="'悬浮内容'"
|
112
|
+
overlay-trigger="hover"
|
113
|
+
/></code></pre>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div class="section">
|
118
|
+
<h2>图集模式</h2>
|
119
|
+
<div class="example-block">
|
120
|
+
<t-image
|
121
|
+
:style="{ width: '100px', height: '100px' }"
|
122
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
123
|
+
:gallery="true"
|
124
|
+
/>
|
125
|
+
</div>
|
126
|
+
<div class="code-block">
|
127
|
+
<pre><code><t-image
|
128
|
+
:style="{ width: '100px', height: '100px' }"
|
129
|
+
src="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
|
130
|
+
:gallery="true"
|
131
|
+
/></code></pre>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
</template>
|
136
|
+
|
137
|
+
<script>
|
138
|
+
export default {
|
139
|
+
name: 'TdesignImage',
|
140
|
+
setup() {
|
141
|
+
const fitList = ['fill', 'contain', 'cover', 'none', 'scale-down'];
|
142
|
+
const shapeList = ['square', 'round', 'circle'];
|
143
|
+
|
144
|
+
return {
|
145
|
+
fitList,
|
146
|
+
shapeList
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
</script>
|
151
|
+
|
152
|
+
<style scoped>
|
153
|
+
.container {
|
154
|
+
padding: 20px;
|
155
|
+
}
|
156
|
+
|
157
|
+
h1 {
|
158
|
+
font-size: 28px;
|
159
|
+
margin-bottom: 24px;
|
160
|
+
color: #0052d9;
|
161
|
+
}
|
162
|
+
|
163
|
+
.section {
|
164
|
+
margin-bottom: 32px;
|
165
|
+
}
|
166
|
+
|
167
|
+
h2 {
|
168
|
+
font-size: 20px;
|
169
|
+
margin-bottom: 16px;
|
170
|
+
color: #333;
|
171
|
+
}
|
172
|
+
|
173
|
+
.example-block {
|
174
|
+
margin-bottom: 12px;
|
175
|
+
display: flex;
|
176
|
+
flex-wrap: wrap;
|
177
|
+
gap: 20px;
|
178
|
+
}
|
179
|
+
|
180
|
+
.code-block {
|
181
|
+
background-color: #f5f5f5;
|
182
|
+
padding: 12px;
|
183
|
+
border-radius: 4px;
|
184
|
+
font-family: monospace;
|
185
|
+
}
|
186
|
+
|
187
|
+
pre {
|
188
|
+
margin: 0;
|
189
|
+
white-space: pre-wrap;
|
190
|
+
}
|
191
|
+
|
192
|
+
code {
|
193
|
+
color: #333;
|
194
|
+
}
|
195
|
+
|
196
|
+
.image-fit-container,
|
197
|
+
.image-shape-container {
|
198
|
+
display: flex;
|
199
|
+
flex-wrap: wrap;
|
200
|
+
gap: 20px;
|
201
|
+
}
|
202
|
+
|
203
|
+
.image-fit-item,
|
204
|
+
.image-shape-item {
|
205
|
+
display: flex;
|
206
|
+
flex-direction: column;
|
207
|
+
align-items: center;
|
208
|
+
gap: 8px;
|
209
|
+
}
|
210
|
+
|
211
|
+
.image-fit-text,
|
212
|
+
.image-shape-text {
|
213
|
+
font-size: 14px;
|
214
|
+
color: #666;
|
215
|
+
}
|
216
|
+
</style>
|
@@ -0,0 +1,199 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="container">
|
3
|
+
<h1>TDesign 图片查看器组件示例</h1>
|
4
|
+
|
5
|
+
<div class="section">
|
6
|
+
<h2>基础用法</h2>
|
7
|
+
<div class="example-block">
|
8
|
+
<t-image-viewer
|
9
|
+
:images="baseImages"
|
10
|
+
:default-visible="false"
|
11
|
+
trigger-text="查看图片"
|
12
|
+
/>
|
13
|
+
</div>
|
14
|
+
<div class="code-block">
|
15
|
+
<pre><code><t-image-viewer
|
16
|
+
:images="images"
|
17
|
+
:default-visible="false"
|
18
|
+
trigger-text="查看图片"
|
19
|
+
/></code></pre>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="section">
|
24
|
+
<h2>自定义触发元素</h2>
|
25
|
+
<div class="example-block">
|
26
|
+
<t-image-viewer :images="baseImages">
|
27
|
+
<t-button theme="primary" variant="outline">自定义触发按钮</t-button>
|
28
|
+
</t-image-viewer>
|
29
|
+
</div>
|
30
|
+
<div class="code-block">
|
31
|
+
<pre><code><t-image-viewer :images="images">
|
32
|
+
<t-button theme="primary" variant="outline">自定义触发按钮</t-button>
|
33
|
+
</t-image-viewer></code></pre>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="section">
|
38
|
+
<h2>以特定图片打开</h2>
|
39
|
+
<div class="example-block">
|
40
|
+
<t-image-viewer
|
41
|
+
:images="baseImages"
|
42
|
+
:default-index="2"
|
43
|
+
trigger-text="从第3张图片开始查看"
|
44
|
+
/>
|
45
|
+
</div>
|
46
|
+
<div class="code-block">
|
47
|
+
<pre><code><t-image-viewer
|
48
|
+
:images="images"
|
49
|
+
:default-index="2"
|
50
|
+
trigger-text="从第3张图片开始查看"
|
51
|
+
/></code></pre>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div class="section">
|
56
|
+
<h2>简洁模式</h2>
|
57
|
+
<div class="example-block">
|
58
|
+
<t-image-viewer
|
59
|
+
:images="baseImages"
|
60
|
+
mode="simple"
|
61
|
+
trigger-text="简洁模式查看图片"
|
62
|
+
/>
|
63
|
+
</div>
|
64
|
+
<div class="code-block">
|
65
|
+
<pre><code><t-image-viewer
|
66
|
+
:images="images"
|
67
|
+
mode="simple"
|
68
|
+
trigger-text="简洁模式查看图片"
|
69
|
+
/></code></pre>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div class="section">
|
74
|
+
<h2>拖拽调整</h2>
|
75
|
+
<div class="example-block">
|
76
|
+
<t-image-viewer
|
77
|
+
:images="baseImages"
|
78
|
+
:draggable="true"
|
79
|
+
trigger-text="支持拖拽调整位置"
|
80
|
+
/>
|
81
|
+
</div>
|
82
|
+
<div class="code-block">
|
83
|
+
<pre><code><t-image-viewer
|
84
|
+
:images="images"
|
85
|
+
:draggable="true"
|
86
|
+
trigger-text="支持拖拽调整位置"
|
87
|
+
/></code></pre>
|
88
|
+
</div>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div class="section">
|
92
|
+
<h2>使用受控属性</h2>
|
93
|
+
<div class="example-block">
|
94
|
+
<div style="margin-bottom: 16px;">
|
95
|
+
<t-button @click="visible = true">打开图片查看器</t-button>
|
96
|
+
</div>
|
97
|
+
<t-image-viewer
|
98
|
+
v-model:visible="visible"
|
99
|
+
:images="baseImages"
|
100
|
+
/>
|
101
|
+
</div>
|
102
|
+
<div class="code-block">
|
103
|
+
<pre><code><t-button @click="visible = true">打开图片查看器</t-button>
|
104
|
+
|
105
|
+
<t-image-viewer
|
106
|
+
v-model:visible="visible"
|
107
|
+
:images="images"
|
108
|
+
/></code></pre>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<div class="section">
|
113
|
+
<h2>自定义标题和无遮罩</h2>
|
114
|
+
<div class="example-block">
|
115
|
+
<t-image-viewer
|
116
|
+
:images="baseImages"
|
117
|
+
:show-overlay="false"
|
118
|
+
title="自定义标题"
|
119
|
+
trigger-text="无遮罩和自定义标题"
|
120
|
+
/>
|
121
|
+
</div>
|
122
|
+
<div class="code-block">
|
123
|
+
<pre><code><t-image-viewer
|
124
|
+
:images="images"
|
125
|
+
:show-overlay="false"
|
126
|
+
title="自定义标题"
|
127
|
+
trigger-text="无遮罩和自定义标题"
|
128
|
+
/></code></pre>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</template>
|
133
|
+
|
134
|
+
<script>
|
135
|
+
import { ref } from 'vue';
|
136
|
+
|
137
|
+
export default {
|
138
|
+
name: 'TdesignImageViewer',
|
139
|
+
setup() {
|
140
|
+
const visible = ref(false);
|
141
|
+
|
142
|
+
// 示例图片数组
|
143
|
+
const baseImages = [
|
144
|
+
'https://tdesign.tencent.com/vue-next/assets/image1.jpg',
|
145
|
+
'https://tdesign.tencent.com/vue-next/assets/image2.jpg',
|
146
|
+
'https://tdesign.tencent.com/vue-next/assets/image3.jpg',
|
147
|
+
'https://tdesign.tencent.com/vue-next/assets/image4.jpg',
|
148
|
+
'https://tdesign.tencent.com/vue-next/assets/image5.jpg'
|
149
|
+
];
|
150
|
+
|
151
|
+
return {
|
152
|
+
visible,
|
153
|
+
baseImages
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
</script>
|
158
|
+
|
159
|
+
<style scoped>
|
160
|
+
.container {
|
161
|
+
padding: 20px;
|
162
|
+
}
|
163
|
+
|
164
|
+
h1 {
|
165
|
+
font-size: 28px;
|
166
|
+
margin-bottom: 24px;
|
167
|
+
color: #0052d9;
|
168
|
+
}
|
169
|
+
|
170
|
+
.section {
|
171
|
+
margin-bottom: 32px;
|
172
|
+
}
|
173
|
+
|
174
|
+
h2 {
|
175
|
+
font-size: 20px;
|
176
|
+
margin-bottom: 16px;
|
177
|
+
color: #333;
|
178
|
+
}
|
179
|
+
|
180
|
+
.example-block {
|
181
|
+
margin-bottom: 12px;
|
182
|
+
}
|
183
|
+
|
184
|
+
.code-block {
|
185
|
+
background-color: #f5f5f5;
|
186
|
+
padding: 12px;
|
187
|
+
border-radius: 4px;
|
188
|
+
font-family: monospace;
|
189
|
+
}
|
190
|
+
|
191
|
+
pre {
|
192
|
+
margin: 0;
|
193
|
+
white-space: pre-wrap;
|
194
|
+
}
|
195
|
+
|
196
|
+
code {
|
197
|
+
color: #333;
|
198
|
+
}
|
199
|
+
</style>
|
@@ -0,0 +1,253 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="tdesign-input-demo">
|
3
|
+
<h2>TDesign 输入框示例</h2>
|
4
|
+
|
5
|
+
<div class="section">
|
6
|
+
<h3>基础输入框</h3>
|
7
|
+
<div class="input-row">
|
8
|
+
<ebiz-tdesign-input placeholder="请输入内容" />
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="section">
|
13
|
+
<h3>不同尺寸</h3>
|
14
|
+
<div class="input-row">
|
15
|
+
<ebiz-tdesign-input placeholder="小尺寸" size="small" />
|
16
|
+
<ebiz-tdesign-input placeholder="中尺寸" size="medium" />
|
17
|
+
<ebiz-tdesign-input placeholder="大尺寸" size="large" />
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="section">
|
22
|
+
<h3>不同状态</h3>
|
23
|
+
<div class="input-row">
|
24
|
+
<ebiz-tdesign-input placeholder="默认状态" />
|
25
|
+
<ebiz-tdesign-input placeholder="禁用状态" disabled />
|
26
|
+
<ebiz-tdesign-input placeholder="只读状态" readonly />
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="section">
|
31
|
+
<h3>带清除按钮的输入框</h3>
|
32
|
+
<div class="input-row">
|
33
|
+
<ebiz-tdesign-input placeholder="可清除内容" clearable />
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="section">
|
38
|
+
<h3>带前缀和后缀的输入框</h3>
|
39
|
+
<div class="input-row">
|
40
|
+
<ebiz-tdesign-input placeholder="带前缀标签">
|
41
|
+
<template #label>
|
42
|
+
<span>账号:</span>
|
43
|
+
</template>
|
44
|
+
</ebiz-tdesign-input>
|
45
|
+
|
46
|
+
<ebiz-tdesign-input placeholder="带后缀标签">
|
47
|
+
<template #suffix>
|
48
|
+
<span>元</span>
|
49
|
+
</template>
|
50
|
+
</ebiz-tdesign-input>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div class="section">
|
55
|
+
<h3>带前缀和后缀图标的输入框</h3>
|
56
|
+
<div class="input-row">
|
57
|
+
<ebiz-tdesign-input placeholder="带前缀图标">
|
58
|
+
<template #prefixIcon>
|
59
|
+
<ebiz-tdesign-icon name="search" />
|
60
|
+
</template>
|
61
|
+
</ebiz-tdesign-input>
|
62
|
+
|
63
|
+
<ebiz-tdesign-input placeholder="带后缀图标">
|
64
|
+
<template #suffixIcon>
|
65
|
+
<ebiz-tdesign-icon name="lock-on" />
|
66
|
+
</template>
|
67
|
+
</ebiz-tdesign-input>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<div class="section">
|
72
|
+
<h3>不同类型的输入框</h3>
|
73
|
+
<div class="input-row">
|
74
|
+
<ebiz-tdesign-input placeholder="文本输入框" type="text" />
|
75
|
+
<ebiz-tdesign-input placeholder="数字输入框" type="number" />
|
76
|
+
<ebiz-tdesign-input placeholder="密码输入框" type="password" />
|
77
|
+
<ebiz-tdesign-input placeholder="URL输入框" type="url" />
|
78
|
+
</div>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<div class="section">
|
82
|
+
<h3>带字数限制的输入框</h3>
|
83
|
+
<div class="input-row">
|
84
|
+
<ebiz-tdesign-input
|
85
|
+
placeholder="最多输入20个字符"
|
86
|
+
maxlength="20"
|
87
|
+
show-limit-number
|
88
|
+
/>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<div class="section">
|
93
|
+
<h3>带状态提示的输入框</h3>
|
94
|
+
<div class="input-row">
|
95
|
+
<ebiz-tdesign-input
|
96
|
+
placeholder="成功状态"
|
97
|
+
status="success"
|
98
|
+
tips="验证通过"
|
99
|
+
/>
|
100
|
+
|
101
|
+
<ebiz-tdesign-input
|
102
|
+
placeholder="警告状态"
|
103
|
+
status="warning"
|
104
|
+
tips="请注意格式"
|
105
|
+
/>
|
106
|
+
|
107
|
+
<ebiz-tdesign-input
|
108
|
+
placeholder="错误状态"
|
109
|
+
status="error"
|
110
|
+
tips="输入有误,请重新输入"
|
111
|
+
/>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="section">
|
116
|
+
<h3>对齐方式</h3>
|
117
|
+
<div class="input-row">
|
118
|
+
<ebiz-tdesign-input placeholder="左对齐" align="left" />
|
119
|
+
<ebiz-tdesign-input placeholder="居中对齐" align="center" />
|
120
|
+
<ebiz-tdesign-input placeholder="右对齐" align="right" />
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div class="section">
|
125
|
+
<h3>事件处理</h3>
|
126
|
+
<div class="input-row">
|
127
|
+
<ebiz-tdesign-input
|
128
|
+
placeholder="监听输入与焦点事件"
|
129
|
+
@input="handleInput"
|
130
|
+
@focus="handleFocus"
|
131
|
+
@blur="handleBlur"
|
132
|
+
@enter="handleEnter"
|
133
|
+
/>
|
134
|
+
</div>
|
135
|
+
<div v-if="inputValue" class="event-output">
|
136
|
+
当前输入值: {{ inputValue }}
|
137
|
+
</div>
|
138
|
+
<div v-if="focusState" class="event-output focus">
|
139
|
+
输入框获得焦点
|
140
|
+
</div>
|
141
|
+
<div v-if="blurState" class="event-output blur">
|
142
|
+
输入框失去焦点
|
143
|
+
</div>
|
144
|
+
<div v-if="enterState" class="event-output enter">
|
145
|
+
按下回车键,输入值: {{ enterValue }}
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
</template>
|
150
|
+
|
151
|
+
<script>
|
152
|
+
import { EbizTdesignInput, EbizTdesignIcon } from '../index.js'
|
153
|
+
|
154
|
+
export default {
|
155
|
+
name: 'TdesignInputDemo',
|
156
|
+
components: {
|
157
|
+
EbizTdesignInput,
|
158
|
+
EbizTdesignIcon
|
159
|
+
},
|
160
|
+
data() {
|
161
|
+
return {
|
162
|
+
inputValue: '',
|
163
|
+
focusState: false,
|
164
|
+
blurState: false,
|
165
|
+
enterState: false,
|
166
|
+
enterValue: ''
|
167
|
+
}
|
168
|
+
},
|
169
|
+
methods: {
|
170
|
+
handleInput(value) {
|
171
|
+
this.inputValue = value;
|
172
|
+
this.blurState = false;
|
173
|
+
},
|
174
|
+
handleFocus() {
|
175
|
+
this.focusState = true;
|
176
|
+
this.blurState = false;
|
177
|
+
},
|
178
|
+
handleBlur() {
|
179
|
+
this.blurState = true;
|
180
|
+
this.focusState = false;
|
181
|
+
},
|
182
|
+
handleEnter(value) {
|
183
|
+
this.enterState = true;
|
184
|
+
this.enterValue = value;
|
185
|
+
// 3秒后自动清除状态
|
186
|
+
setTimeout(() => {
|
187
|
+
this.enterState = false;
|
188
|
+
}, 3000);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}
|
192
|
+
</script>
|
193
|
+
|
194
|
+
<style scoped>
|
195
|
+
.tdesign-input-demo {
|
196
|
+
padding: 20px;
|
197
|
+
max-width: 1200px;
|
198
|
+
margin: 0 auto;
|
199
|
+
}
|
200
|
+
|
201
|
+
.section {
|
202
|
+
margin-bottom: 30px;
|
203
|
+
border-bottom: 1px solid #eee;
|
204
|
+
padding-bottom: 20px;
|
205
|
+
}
|
206
|
+
|
207
|
+
h2 {
|
208
|
+
margin-bottom: 20px;
|
209
|
+
font-size: 24px;
|
210
|
+
color: #0052d9;
|
211
|
+
}
|
212
|
+
|
213
|
+
h3 {
|
214
|
+
margin-bottom: 12px;
|
215
|
+
font-size: 18px;
|
216
|
+
color: #333;
|
217
|
+
}
|
218
|
+
|
219
|
+
.input-row {
|
220
|
+
display: flex;
|
221
|
+
flex-wrap: wrap;
|
222
|
+
gap: 16px;
|
223
|
+
margin-bottom: 10px;
|
224
|
+
}
|
225
|
+
|
226
|
+
.input-row > * {
|
227
|
+
min-width: 240px;
|
228
|
+
max-width: 100%;
|
229
|
+
}
|
230
|
+
|
231
|
+
.event-output {
|
232
|
+
margin-top: 10px;
|
233
|
+
padding: 8px;
|
234
|
+
background-color: #f5f5f5;
|
235
|
+
border-radius: 4px;
|
236
|
+
font-size: 14px;
|
237
|
+
}
|
238
|
+
|
239
|
+
.focus {
|
240
|
+
background-color: #e6f7ff;
|
241
|
+
color: #1890ff;
|
242
|
+
}
|
243
|
+
|
244
|
+
.blur {
|
245
|
+
background-color: #f6ffed;
|
246
|
+
color: #52c41a;
|
247
|
+
}
|
248
|
+
|
249
|
+
.enter {
|
250
|
+
background-color: #fff7e6;
|
251
|
+
color: #fa8c16;
|
252
|
+
}
|
253
|
+
</style>
|