@vtj/materials 0.10.1-alpha.6 → 0.10.1
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/assets/antdv/index.umd.js +2 -2
- package/dist/assets/charts/index.umd.js +2 -2
- package/dist/assets/element/index.umd.js +2 -2
- package/dist/assets/ui/index.umd.js +2 -2
- package/dist/assets/uni-h5/index.umd.js +2 -2
- package/dist/assets/uni-ui/index.umd.js +3 -3
- package/dist/assets/vant/index.umd.js +5 -5
- package/dist/deps/@vtj/charts/index.umd.js +2 -2
- package/dist/deps/@vtj/icons/index.umd.js +2 -2
- package/dist/deps/@vtj/ui/index.umd.js +2 -2
- package/dist/deps/@vtj/utils/index.umd.js +2 -2
- package/dist/deps/uni-ui/index.umd.js +1 -1
- package/dist/deps/uni-ui/style.css +1 -1
- package/package.json +6 -6
- package/src/uni-ui/components/badge.ts +5 -1
- package/src/uni-ui/components/breadcrumb.ts +76 -0
- package/src/uni-ui/components/calendar.ts +63 -0
- package/src/uni-ui/components/card.ts +113 -0
- package/src/uni-ui/components/collapse.ts +118 -0
- package/src/uni-ui/components/combox.ts +51 -0
- package/src/uni-ui/components/countdown.ts +92 -0
- package/src/uni-ui/components/dataCheckbox.ts +104 -0
- package/src/uni-ui/components/dataPicker.ts +146 -0
- package/src/uni-ui/components/dataSelect.ts +68 -0
- package/src/uni-ui/components/dateformat.ts +42 -0
- package/src/uni-ui/components/datetimePicker.ts +103 -0
- package/src/uni-ui/components/drawer.ts +38 -0
- package/src/uni-ui/components/easyinput.ts +159 -0
- package/src/uni-ui/components/fab.ts +89 -0
- package/src/uni-ui/components/fav.ts +65 -0
- package/src/uni-ui/components/filePicker.ts +127 -0
- package/src/uni-ui/components/forms.ts +209 -0
- package/src/uni-ui/components/goodsNav.ts +31 -0
- package/src/uni-ui/components/grid.ts +104 -0
- package/src/uni-ui/components/group.ts +50 -0
- package/src/uni-ui/components/icons.ts +47 -0
- package/src/uni-ui/components/index.ts +89 -1
- package/src/uni-ui/components/indexedList.ts +51 -0
- package/src/uni-ui/components/link.ts +60 -0
- package/src/uni-ui/components/list.ts +259 -0
- package/src/uni-ui/components/loadMore.ts +61 -0
- package/src/uni-ui/components/navbar.ts +121 -0
- package/src/uni-ui/components/noticeBar.ts +83 -0
- package/src/uni-ui/components/numberbox.ts +49 -0
- package/src/uni-ui/components/pagination.ts +59 -0
- package/src/uni-ui/components/popup.ts +206 -0
- package/src/uni-ui/components/rate.ts +89 -0
- package/src/uni-ui/components/row.ts +126 -0
- package/src/uni-ui/components/searchBar.ts +84 -0
- package/src/uni-ui/components/section.ts +68 -0
- package/src/uni-ui/components/segmentedControl.ts +48 -0
- package/src/uni-ui/components/steps.ts +55 -0
- package/src/uni-ui/components/swipeAction.ts +133 -0
- package/src/uni-ui/components/swiperDot.ts +114 -0
- package/src/uni-ui/components/table.ts +132 -0
- package/src/uni-ui/components/tag.ts +56 -0
- package/src/uni-ui/components/title.ts +49 -0
- package/src/uni-ui/components/tooltip.ts +32 -0
- package/src/uni-ui/components/transition.ts +49 -0
- package/src/uni-ui/index.ts +30 -13
- package/src/uni-ui/lib/uni-col/uni-col.vue +324 -0
- package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +590 -0
- package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +177 -177
- package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +947 -947
- package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +22 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +7 -7
- package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +939 -939
- package/src/uni-ui/lib/uni-datetime-picker/util.js +419 -419
- package/src/uni-ui/lib/uni-easyinput/common.js +54 -0
- package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +790 -0
- package/src/uni-ui/lib/uni-forms/uni-forms.vue +416 -416
- package/src/uni-ui/lib/uni-forms/utils.js +281 -281
- package/src/uni-ui/lib/uni-forms/validate.js +485 -485
- package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +630 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +8 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +231 -0
- package/src/uni-ui/lib/uni-icons/uni-icons.uvue +91 -0
- package/src/uni-ui/lib/uni-icons/uni-icons.vue +114 -0
- package/src/uni-ui/lib/uni-icons/uniicons.css +664 -0
- package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file.ts +664 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +649 -0
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +144 -0
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +404 -0
- package/src/uni-ui/lib/uni-list/uni-list.vue +123 -0
- package/src/uni-ui/lib/uni-list/uni-refresh.vue +65 -0
- package/src/uni-ui/lib/uni-list/uni-refresh.wxs +87 -0
- package/src/uni-ui/lib/uni-popup-dialog/keypress.js +45 -0
- package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +324 -0
- package/src/uni-ui/lib/uni-rate/uni-rate.vue +361 -0
- package/src/uni-ui/lib/uni-table/uni-table.vue +496 -0
- package/src/uni-ui/lib/uni-td/uni-td.vue +99 -0
- package/src/uni-ui/lib/uni-th/uni-th.vue +310 -283
- package/src/uni-ui/lib/uni-tr/uni-tr.vue +194 -170
- package/src/version.ts +2 -2
@@ -0,0 +1,496 @@
|
|
1
|
+
<template>
|
2
|
+
<view
|
3
|
+
class="uni-table-scroll"
|
4
|
+
:class="{ 'table--border': border, 'border-none': !noData }">
|
5
|
+
<!-- #ifdef H5 -->
|
6
|
+
<table
|
7
|
+
class="uni-table"
|
8
|
+
border="0"
|
9
|
+
cellpadding="0"
|
10
|
+
cellspacing="0"
|
11
|
+
:class="{ 'table--stripe': stripe }"
|
12
|
+
:style="{ 'min-width': minWidth + 'px' }">
|
13
|
+
<slot></slot>
|
14
|
+
<tr v-if="noData" class="uni-table-loading">
|
15
|
+
<td class="uni-table-text" :class="{ 'empty-border': border }">
|
16
|
+
{{ emptyText }}
|
17
|
+
</td>
|
18
|
+
</tr>
|
19
|
+
<view
|
20
|
+
v-if="loading"
|
21
|
+
class="uni-table-mask"
|
22
|
+
:class="{ 'empty-border': border }"
|
23
|
+
><div class="uni-table--loader"></div
|
24
|
+
></view>
|
25
|
+
</table>
|
26
|
+
<!-- #endif -->
|
27
|
+
<!-- #ifndef H5 -->
|
28
|
+
<!-- <view class="uni-table" :style="{ 'min-width': minWidth + 'px' }" :class="{ 'table--stripe': stripe }">
|
29
|
+
<slot></slot>
|
30
|
+
<view v-if="noData" class="uni-table-loading">
|
31
|
+
<view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view>
|
32
|
+
</view>
|
33
|
+
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
|
34
|
+
</view> -->
|
35
|
+
<!-- #endif -->
|
36
|
+
</view>
|
37
|
+
</template>
|
38
|
+
|
39
|
+
<script>
|
40
|
+
/**
|
41
|
+
* Table 表格
|
42
|
+
* @description 用于展示多条结构类似的数据
|
43
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=3270
|
44
|
+
* @property {Boolean} border 是否带有纵向边框
|
45
|
+
* @property {Boolean} stripe 是否显示斑马线
|
46
|
+
* @property {Boolean} type 是否开启多选
|
47
|
+
* @property {String} emptyText 空数据时显示的文本内容
|
48
|
+
* @property {Boolean} loading 显示加载中
|
49
|
+
* @event {Function} selection-change 开启多选时,当选择项发生变化时会触发该事件
|
50
|
+
*/
|
51
|
+
export default {
|
52
|
+
name: 'uniTable',
|
53
|
+
options: {
|
54
|
+
// #ifdef MP-TOUTIAO
|
55
|
+
virtualHost: false,
|
56
|
+
// #endif
|
57
|
+
// #ifndef MP-TOUTIAO
|
58
|
+
virtualHost: true
|
59
|
+
// #endif
|
60
|
+
},
|
61
|
+
emits: ['selection-change'],
|
62
|
+
props: {
|
63
|
+
data: {
|
64
|
+
type: Array,
|
65
|
+
default() {
|
66
|
+
return [];
|
67
|
+
}
|
68
|
+
},
|
69
|
+
// 是否有竖线
|
70
|
+
border: {
|
71
|
+
type: Boolean,
|
72
|
+
default: false
|
73
|
+
},
|
74
|
+
// 是否显示斑马线
|
75
|
+
stripe: {
|
76
|
+
type: Boolean,
|
77
|
+
default: false
|
78
|
+
},
|
79
|
+
// 多选
|
80
|
+
type: {
|
81
|
+
type: String,
|
82
|
+
default: ''
|
83
|
+
},
|
84
|
+
// 没有更多数据
|
85
|
+
emptyText: {
|
86
|
+
type: String,
|
87
|
+
default: '没有更多数据'
|
88
|
+
},
|
89
|
+
loading: {
|
90
|
+
type: Boolean,
|
91
|
+
default: false
|
92
|
+
},
|
93
|
+
rowKey: {
|
94
|
+
type: String,
|
95
|
+
default: ''
|
96
|
+
}
|
97
|
+
},
|
98
|
+
data() {
|
99
|
+
return {
|
100
|
+
noData: true,
|
101
|
+
minWidth: 0,
|
102
|
+
multiTableHeads: []
|
103
|
+
};
|
104
|
+
},
|
105
|
+
watch: {
|
106
|
+
loading(val) {},
|
107
|
+
data(newVal) {
|
108
|
+
let theadChildren = this.theadChildren;
|
109
|
+
let rowspan = 1;
|
110
|
+
if (this.theadChildren) {
|
111
|
+
rowspan = this.theadChildren.rowspan;
|
112
|
+
}
|
113
|
+
|
114
|
+
// this.trChildren.length - rowspan
|
115
|
+
this.noData = false;
|
116
|
+
// this.noData = newVal.length === 0
|
117
|
+
}
|
118
|
+
},
|
119
|
+
created() {
|
120
|
+
// 定义tr的实例数组
|
121
|
+
this.trChildren = [];
|
122
|
+
this.thChildren = [];
|
123
|
+
this.theadChildren = null;
|
124
|
+
this.backData = [];
|
125
|
+
this.backIndexData = [];
|
126
|
+
},
|
127
|
+
|
128
|
+
methods: {
|
129
|
+
isNodata() {
|
130
|
+
let theadChildren = this.theadChildren;
|
131
|
+
let rowspan = 1;
|
132
|
+
if (this.theadChildren) {
|
133
|
+
rowspan = this.theadChildren.rowspan;
|
134
|
+
}
|
135
|
+
this.noData = this.trChildren.length - rowspan <= 0;
|
136
|
+
},
|
137
|
+
/**
|
138
|
+
* 选中所有
|
139
|
+
*/
|
140
|
+
selectionAll() {
|
141
|
+
let startIndex = 1;
|
142
|
+
let theadChildren = this.theadChildren;
|
143
|
+
if (!this.theadChildren) {
|
144
|
+
theadChildren = this.trChildren[0];
|
145
|
+
} else {
|
146
|
+
startIndex = theadChildren.rowspan - 1;
|
147
|
+
}
|
148
|
+
let isHaveData = this.data && this.data.length > 0;
|
149
|
+
theadChildren.checked = true;
|
150
|
+
theadChildren.indeterminate = false;
|
151
|
+
this.trChildren.forEach((item, index) => {
|
152
|
+
if (!item.disabled) {
|
153
|
+
item.checked = true;
|
154
|
+
if (isHaveData && item.keyValue) {
|
155
|
+
const row = this.data.find(
|
156
|
+
(v) => v[this.rowKey] === item.keyValue
|
157
|
+
);
|
158
|
+
if (
|
159
|
+
!this.backData.find((v) => v[this.rowKey] === row[this.rowKey])
|
160
|
+
) {
|
161
|
+
this.backData.push(row);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
if (
|
165
|
+
index > startIndex - 1 &&
|
166
|
+
this.backIndexData.indexOf(index - startIndex) === -1
|
167
|
+
) {
|
168
|
+
this.backIndexData.push(index - startIndex);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
});
|
172
|
+
// this.backData = JSON.parse(JSON.stringify(this.data))
|
173
|
+
this.$emit('selection-change', {
|
174
|
+
detail: {
|
175
|
+
value: this.backData,
|
176
|
+
index: this.backIndexData
|
177
|
+
}
|
178
|
+
});
|
179
|
+
},
|
180
|
+
/**
|
181
|
+
* 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
|
182
|
+
*/
|
183
|
+
toggleRowSelection(row, selected) {
|
184
|
+
// if (!this.theadChildren) return
|
185
|
+
row = [].concat(row);
|
186
|
+
|
187
|
+
this.trChildren.forEach((item, index) => {
|
188
|
+
// if (item.keyValue) {
|
189
|
+
|
190
|
+
const select = row.findIndex((v) => {
|
191
|
+
//
|
192
|
+
if (typeof v === 'number') {
|
193
|
+
return v === index - 1;
|
194
|
+
} else {
|
195
|
+
return v[this.rowKey] === item.keyValue;
|
196
|
+
}
|
197
|
+
});
|
198
|
+
let ischeck = item.checked;
|
199
|
+
if (select !== -1) {
|
200
|
+
if (typeof selected === 'boolean') {
|
201
|
+
item.checked = selected;
|
202
|
+
} else {
|
203
|
+
item.checked = !item.checked;
|
204
|
+
}
|
205
|
+
if (ischeck !== item.checked) {
|
206
|
+
this.check(
|
207
|
+
item.rowData || item,
|
208
|
+
item.checked,
|
209
|
+
item.rowData ? item.keyValue : null,
|
210
|
+
true
|
211
|
+
);
|
212
|
+
}
|
213
|
+
}
|
214
|
+
// }
|
215
|
+
});
|
216
|
+
this.$emit('selection-change', {
|
217
|
+
detail: {
|
218
|
+
value: this.backData,
|
219
|
+
index: this.backIndexData
|
220
|
+
}
|
221
|
+
});
|
222
|
+
},
|
223
|
+
|
224
|
+
/**
|
225
|
+
* 用于多选表格,清空用户的选择
|
226
|
+
*/
|
227
|
+
clearSelection() {
|
228
|
+
let theadChildren = this.theadChildren;
|
229
|
+
if (!this.theadChildren) {
|
230
|
+
theadChildren = this.trChildren[0];
|
231
|
+
}
|
232
|
+
// if (!this.theadChildren) return
|
233
|
+
theadChildren.checked = false;
|
234
|
+
theadChildren.indeterminate = false;
|
235
|
+
this.trChildren.forEach((item) => {
|
236
|
+
// if (item.keyValue) {
|
237
|
+
item.checked = false;
|
238
|
+
// }
|
239
|
+
});
|
240
|
+
this.backData = [];
|
241
|
+
this.backIndexData = [];
|
242
|
+
this.$emit('selection-change', {
|
243
|
+
detail: {
|
244
|
+
value: [],
|
245
|
+
index: []
|
246
|
+
}
|
247
|
+
});
|
248
|
+
},
|
249
|
+
/**
|
250
|
+
* 用于多选表格,切换所有行的选中状态
|
251
|
+
*/
|
252
|
+
toggleAllSelection() {
|
253
|
+
let list = [];
|
254
|
+
let startIndex = 1;
|
255
|
+
let theadChildren = this.theadChildren;
|
256
|
+
if (!this.theadChildren) {
|
257
|
+
theadChildren = this.trChildren[0];
|
258
|
+
} else {
|
259
|
+
startIndex = theadChildren.rowspan - 1;
|
260
|
+
}
|
261
|
+
this.trChildren.forEach((item, index) => {
|
262
|
+
if (!item.disabled) {
|
263
|
+
if (index > startIndex - 1) {
|
264
|
+
list.push(index - startIndex);
|
265
|
+
}
|
266
|
+
}
|
267
|
+
});
|
268
|
+
this.toggleRowSelection(list);
|
269
|
+
},
|
270
|
+
|
271
|
+
/**
|
272
|
+
* 选中\取消选中
|
273
|
+
* @param {Object} child
|
274
|
+
* @param {Object} check
|
275
|
+
* @param {Object} rowValue
|
276
|
+
*/
|
277
|
+
check(child, check, keyValue, emit) {
|
278
|
+
let theadChildren = this.theadChildren;
|
279
|
+
if (!this.theadChildren) {
|
280
|
+
theadChildren = this.trChildren[0];
|
281
|
+
}
|
282
|
+
|
283
|
+
let childDomIndex = this.trChildren.findIndex(
|
284
|
+
(item, index) => child === item
|
285
|
+
);
|
286
|
+
if (childDomIndex < 0) {
|
287
|
+
childDomIndex =
|
288
|
+
this.data.findIndex((v) => v[this.rowKey] === keyValue) + 1;
|
289
|
+
}
|
290
|
+
const dataLen = this.trChildren.filter(
|
291
|
+
(v) => !v.disabled && v.keyValue
|
292
|
+
).length;
|
293
|
+
if (childDomIndex === 0) {
|
294
|
+
check ? this.selectionAll() : this.clearSelection();
|
295
|
+
return;
|
296
|
+
}
|
297
|
+
|
298
|
+
if (check) {
|
299
|
+
if (keyValue) {
|
300
|
+
this.backData.push(child);
|
301
|
+
}
|
302
|
+
this.backIndexData.push(childDomIndex - 1);
|
303
|
+
} else {
|
304
|
+
const index = this.backData.findIndex(
|
305
|
+
(v) => v[this.rowKey] === keyValue
|
306
|
+
);
|
307
|
+
const idx = this.backIndexData.findIndex(
|
308
|
+
(item) => item === childDomIndex - 1
|
309
|
+
);
|
310
|
+
if (keyValue) {
|
311
|
+
this.backData.splice(index, 1);
|
312
|
+
}
|
313
|
+
this.backIndexData.splice(idx, 1);
|
314
|
+
}
|
315
|
+
|
316
|
+
const domCheckAll = this.trChildren.find(
|
317
|
+
(item, index) => index > 0 && !item.checked && !item.disabled
|
318
|
+
);
|
319
|
+
if (!domCheckAll) {
|
320
|
+
theadChildren.indeterminate = false;
|
321
|
+
theadChildren.checked = true;
|
322
|
+
} else {
|
323
|
+
theadChildren.indeterminate = true;
|
324
|
+
theadChildren.checked = false;
|
325
|
+
}
|
326
|
+
|
327
|
+
if (this.backIndexData.length === 0) {
|
328
|
+
theadChildren.indeterminate = false;
|
329
|
+
}
|
330
|
+
|
331
|
+
if (!emit) {
|
332
|
+
this.$emit('selection-change', {
|
333
|
+
detail: {
|
334
|
+
value: this.backData,
|
335
|
+
index: this.backIndexData
|
336
|
+
}
|
337
|
+
});
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
};
|
342
|
+
</script>
|
343
|
+
|
344
|
+
<style lang="scss">
|
345
|
+
$border-color: #ebeef5;
|
346
|
+
|
347
|
+
.uni-table-scroll {
|
348
|
+
width: 100%;
|
349
|
+
/* #ifndef APP-NVUE */
|
350
|
+
overflow-x: auto;
|
351
|
+
/* #endif */
|
352
|
+
}
|
353
|
+
|
354
|
+
.uni-table {
|
355
|
+
position: relative;
|
356
|
+
width: 100%;
|
357
|
+
border-radius: 5px;
|
358
|
+
// box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.1);
|
359
|
+
background-color: #fff;
|
360
|
+
/* #ifndef APP-NVUE */
|
361
|
+
box-sizing: border-box;
|
362
|
+
display: table;
|
363
|
+
overflow-x: auto;
|
364
|
+
::v-deep .uni-table-tr:nth-child(n + 2) {
|
365
|
+
&:hover {
|
366
|
+
background-color: #f5f7fa;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
::v-deep .uni-table-thead {
|
370
|
+
.uni-table-tr {
|
371
|
+
// background-color: #f5f7fa;
|
372
|
+
&:hover {
|
373
|
+
background-color: #fafafa;
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
/* #endif */
|
378
|
+
}
|
379
|
+
|
380
|
+
.table--border {
|
381
|
+
border: 1px $border-color solid;
|
382
|
+
border-right: none;
|
383
|
+
}
|
384
|
+
|
385
|
+
.border-none {
|
386
|
+
/* #ifndef APP-NVUE */
|
387
|
+
border-bottom: none;
|
388
|
+
/* #endif */
|
389
|
+
}
|
390
|
+
|
391
|
+
.table--stripe {
|
392
|
+
/* #ifndef APP-NVUE */
|
393
|
+
::v-deep .uni-table-tr:nth-child(2n + 3) {
|
394
|
+
background-color: #fafafa;
|
395
|
+
}
|
396
|
+
/* #endif */
|
397
|
+
}
|
398
|
+
|
399
|
+
/* 表格加载、无数据样式 */
|
400
|
+
.uni-table-loading {
|
401
|
+
position: relative;
|
402
|
+
/* #ifndef APP-NVUE */
|
403
|
+
display: table-row;
|
404
|
+
/* #endif */
|
405
|
+
height: 50px;
|
406
|
+
line-height: 50px;
|
407
|
+
overflow: hidden;
|
408
|
+
box-sizing: border-box;
|
409
|
+
}
|
410
|
+
.empty-border {
|
411
|
+
border-right: 1px $border-color solid;
|
412
|
+
}
|
413
|
+
.uni-table-text {
|
414
|
+
position: absolute;
|
415
|
+
right: 0;
|
416
|
+
left: 0;
|
417
|
+
text-align: center;
|
418
|
+
font-size: 14px;
|
419
|
+
color: #999;
|
420
|
+
}
|
421
|
+
|
422
|
+
.uni-table-mask {
|
423
|
+
position: absolute;
|
424
|
+
top: 0;
|
425
|
+
bottom: 0;
|
426
|
+
left: 0;
|
427
|
+
right: 0;
|
428
|
+
background-color: rgba(255, 255, 255, 0.8);
|
429
|
+
z-index: 99;
|
430
|
+
/* #ifndef APP-NVUE */
|
431
|
+
display: flex;
|
432
|
+
margin: auto;
|
433
|
+
transition: all 0.5s;
|
434
|
+
/* #endif */
|
435
|
+
justify-content: center;
|
436
|
+
align-items: center;
|
437
|
+
}
|
438
|
+
|
439
|
+
.uni-table--loader {
|
440
|
+
width: 30px;
|
441
|
+
height: 30px;
|
442
|
+
border: 2px solid #aaa;
|
443
|
+
// border-bottom-color: transparent;
|
444
|
+
border-radius: 50%;
|
445
|
+
/* #ifndef APP-NVUE */
|
446
|
+
animation: 2s uni-table--loader linear infinite;
|
447
|
+
/* #endif */
|
448
|
+
position: relative;
|
449
|
+
}
|
450
|
+
|
451
|
+
@keyframes uni-table--loader {
|
452
|
+
0% {
|
453
|
+
transform: rotate(360deg);
|
454
|
+
}
|
455
|
+
|
456
|
+
10% {
|
457
|
+
border-left-color: transparent;
|
458
|
+
}
|
459
|
+
|
460
|
+
20% {
|
461
|
+
border-bottom-color: transparent;
|
462
|
+
}
|
463
|
+
|
464
|
+
30% {
|
465
|
+
border-right-color: transparent;
|
466
|
+
}
|
467
|
+
|
468
|
+
40% {
|
469
|
+
border-top-color: transparent;
|
470
|
+
}
|
471
|
+
|
472
|
+
50% {
|
473
|
+
transform: rotate(0deg);
|
474
|
+
}
|
475
|
+
|
476
|
+
60% {
|
477
|
+
border-top-color: transparent;
|
478
|
+
}
|
479
|
+
|
480
|
+
70% {
|
481
|
+
border-left-color: transparent;
|
482
|
+
}
|
483
|
+
|
484
|
+
80% {
|
485
|
+
border-bottom-color: transparent;
|
486
|
+
}
|
487
|
+
|
488
|
+
90% {
|
489
|
+
border-right-color: transparent;
|
490
|
+
}
|
491
|
+
|
492
|
+
100% {
|
493
|
+
transform: rotate(-360deg);
|
494
|
+
}
|
495
|
+
}
|
496
|
+
</style>
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<template>
|
2
|
+
<!-- #ifdef H5 -->
|
3
|
+
<td
|
4
|
+
class="uni-table-td"
|
5
|
+
:rowspan="rowspan"
|
6
|
+
:colspan="colspan"
|
7
|
+
:class="{ 'table--border': border }"
|
8
|
+
:style="{ width: width + 'px', 'text-align': align }">
|
9
|
+
<slot></slot>
|
10
|
+
</td>
|
11
|
+
<!-- #endif -->
|
12
|
+
<!-- #ifndef H5 -->
|
13
|
+
<!-- :class="{'table--border':border}" -->
|
14
|
+
<!-- <view class="uni-table-td" :class="{'table--border':border}" :style="{width:width + 'px','text-align':align}">
|
15
|
+
<slot></slot>
|
16
|
+
</view> -->
|
17
|
+
<!-- #endif -->
|
18
|
+
</template>
|
19
|
+
|
20
|
+
<script>
|
21
|
+
/**
|
22
|
+
* Td 单元格
|
23
|
+
* @description 表格中的标准单元格组件
|
24
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=3270
|
25
|
+
* @property {Number} align = [left|center|right] 单元格对齐方式
|
26
|
+
*/
|
27
|
+
export default {
|
28
|
+
name: 'uniTd',
|
29
|
+
options: {
|
30
|
+
// #ifdef MP-TOUTIAO
|
31
|
+
virtualHost: false,
|
32
|
+
// #endif
|
33
|
+
// #ifndef MP-TOUTIAO
|
34
|
+
virtualHost: true
|
35
|
+
// #endif
|
36
|
+
},
|
37
|
+
props: {
|
38
|
+
width: {
|
39
|
+
type: [String, Number],
|
40
|
+
default: ''
|
41
|
+
},
|
42
|
+
align: {
|
43
|
+
type: String,
|
44
|
+
default: 'left'
|
45
|
+
},
|
46
|
+
rowspan: {
|
47
|
+
type: [Number, String],
|
48
|
+
default: 1
|
49
|
+
},
|
50
|
+
colspan: {
|
51
|
+
type: [Number, String],
|
52
|
+
default: 1
|
53
|
+
}
|
54
|
+
},
|
55
|
+
data() {
|
56
|
+
return {
|
57
|
+
border: false
|
58
|
+
};
|
59
|
+
},
|
60
|
+
created() {
|
61
|
+
this.root = this.getTable();
|
62
|
+
this.border = this.root.border;
|
63
|
+
},
|
64
|
+
methods: {
|
65
|
+
/**
|
66
|
+
* 获取父元素实例
|
67
|
+
*/
|
68
|
+
getTable() {
|
69
|
+
let parent = this.$parent;
|
70
|
+
let parentName = parent.$options.name;
|
71
|
+
while (parentName !== 'uniTable') {
|
72
|
+
parent = parent.$parent;
|
73
|
+
if (!parent) return false;
|
74
|
+
parentName = parent.$options.name;
|
75
|
+
}
|
76
|
+
return parent;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
};
|
80
|
+
</script>
|
81
|
+
|
82
|
+
<style lang="scss">
|
83
|
+
$border-color: #ebeef5;
|
84
|
+
|
85
|
+
.uni-table-td {
|
86
|
+
display: table-cell;
|
87
|
+
padding: 8px 10px;
|
88
|
+
font-size: 14px;
|
89
|
+
border-bottom: 1px $border-color solid;
|
90
|
+
font-weight: 400;
|
91
|
+
color: #606266;
|
92
|
+
line-height: 23px;
|
93
|
+
box-sizing: border-box;
|
94
|
+
}
|
95
|
+
|
96
|
+
.table--border {
|
97
|
+
border-right: 1px $border-color solid;
|
98
|
+
}
|
99
|
+
</style>
|