@10yun/cv-mobile-ui 0.4.1 → 0.4.2
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 +1 -1
- package/ui-cv/cv-badge/{uni-badge.vue → cv-badge.vue} +2 -2
- package/ui-cv/cv-calendar/calendar.js +762 -345
- package/ui-cv/cv-calendar/cv-calendar-item.vue +198 -0
- package/ui-cv/cv-calendar/cv-calendar.vue +508 -0
- package/ui-cv/cv-card/cv-card.vue +427 -0
- package/ui-cv/cv-col/cv-col.vue +2965 -0
- package/ui-cv/cv-collapse/cv-collapse.vue +146 -0
- package/ui-cv/cv-collapse-item/cv-collapse-item.vue +395 -0
- package/ui-cv/cv-combox/cv-combox.vue +250 -0
- package/ui-cv/cv-countdown/cv-countdown.vue +245 -0
- package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +841 -0
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +154 -0
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +376 -0
- package/ui-cv/cv-data-picker/cv-data-picker.vue +486 -0
- package/ui-cv/cv-data-pickerview/{uni-data-picker.js → cv-data-picker.js} +0 -0
- package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +304 -0
- package/ui-cv/cv-dateformat/cv-dateformat.vue +86 -0
- package/ui-cv/cv-datetime-picker/calendar.vue +752 -738
- package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +958 -0
- package/ui-cv/cv-datetime-picker/time-picker.vue +900 -892
- package/ui-cv/cv-easyinput/cv-easyinput.vue +514 -0
- package/ui-cv/cv-fab/cv-fab.vue +465 -0
- package/ui-cv/cv-fab/{uni-fab.vue.bak → cv-fab.vue.bak} +2 -2
- package/ui-cv/cv-fav/cv-fav.vue +150 -0
- package/ui-cv/cv-file-picker/cv-file-picker.vue +619 -0
- package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
- package/ui-cv/cv-goods-nav/{uni-goods-nav.vue → cv-goods-nav.vue} +1 -1
- package/ui-cv/{cv-icons2/cv-icons2.vue → cv-icon2/cv-icon2.vue} +3 -3
- package/ui-cv/{cv-icons2 → cv-icon2}/icons.js +0 -0
- package/ui-cv/{cv-icons2 → cv-icon2}/uni.ttf +0 -0
- package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +154 -0
- package/ui-cv/cv-indexed-list/cv-indexed-list.vue +371 -0
- package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
- package/ui-cv/{cv-link/uni-link.vue → cv-link2/cv-link2.vue} +1 -1
- package/ui-cv/cv-list/cv-list.vue +107 -0
- package/ui-cv/cv-list/cv-refresh.vue +65 -0
- package/ui-cv/cv-list-ad/cv-list-ad.vue +113 -0
- package/ui-cv/cv-list-chat/{uni-list-chat.scss → cv-list-chat.scss} +0 -0
- package/ui-cv/cv-list-chat/{uni-list-chat.vue → cv-list-chat.vue} +0 -0
- package/ui-cv/cv-list-item/cv-list-item.vue +449 -0
- package/ui-cv/cv-nav-bar/cv-nav-bar.vue +256 -0
- package/ui-cv/cv-nav-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
- package/ui-cv/cv-notice-bar/cv-notice-bar.vue +453 -0
- package/ui-cv/cv-number-box/cv-number-box.vue +223 -0
- package/ui-cv/cv-pagination/cv-pagination.vue +397 -0
- package/ui-cv/cv-popup/cv-popup.vue +429 -0
- package/ui-cv/cv-popup-dialog/{uni-popup-dialog.vue → cv-popup-dialog.vue} +0 -0
- package/ui-cv/cv-popup-message/cv-popup-message.vue +143 -0
- package/ui-cv/cv-popup-share/{uni-popup-share.vue → cv-popup-share.vue} +0 -0
- package/ui-cv/cv-row/{uni-row.vue → cv-row.vue} +1 -1
- package/ui-cv/cv-search-bar/cv-search-bar.vue +280 -0
- package/ui-cv/cv-section/{uni-section.vue → cv-section.vue} +0 -0
- package/ui-cv/cv-segmented-control/{uni-segmented-control.vue → cv-segmented-control.vue} +0 -0
- package/ui-cv/cv-status-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
- package/ui-cv/cv-steps/cv-steps.vue +293 -0
- package/ui-cv/cv-swipe-action/{uni-swipe-action.vue → cv-swipe-action.vue} +0 -0
- package/ui-cv/cv-swipe-action-item/{uni-swipe-action-item.vue → cv-swipe-action-item.vue} +0 -0
- package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +255 -0
- package/ui-cv/cv-table/cv-table.vue +460 -0
- package/ui-cv/cv-tag/cv-tag.vue +276 -0
- package/ui-cv/cv-tbody/cv-tbody.vue +28 -0
- package/ui-cv/cv-td/cv-td.vue +93 -0
- package/ui-cv/cv-test/{uni-test.vue → cv-test.vue} +0 -0
- package/ui-cv/cv-th/cv-th.vue +270 -0
- package/ui-cv/cv-thead/cv-thead.vue +114 -0
- package/ui-cv/cv-title/cv-title.vue +168 -0
- package/ui-cv/cv-tr/cv-tr.vue +166 -0
- package/ui-cv/cv-transition/cv-transition.vue +279 -0
- package/ui-cv/cv-calendar/uni-calendar-item.vue +0 -171
- package/ui-cv/cv-calendar/uni-calendar.vue +0 -504
- package/ui-cv/cv-card/uni-card.vue +0 -420
- package/ui-cv/cv-col/uni-col.vue +0 -2968
- package/ui-cv/cv-collapse/uni-collapse.vue +0 -146
- package/ui-cv/cv-collapse-item/uni-collapse-item.vue +0 -378
- package/ui-cv/cv-combox/uni-combox.vue +0 -237
- package/ui-cv/cv-countdown/uni-countdown.vue +0 -234
- package/ui-cv/cv-data-checkbox/uni-data-checkbox.vue +0 -792
- package/ui-cv/cv-data-indexed-list/uni-data-indexed-list-item.vue +0 -142
- package/ui-cv/cv-data-indexed-list/uni-data-indexed-list.vue +0 -364
- package/ui-cv/cv-data-picker/uni-data-picker.vue +0 -468
- package/ui-cv/cv-data-pickerview/uni-data-pickerview.vue +0 -298
- package/ui-cv/cv-dateformat/uni-dateformat.vue +0 -88
- package/ui-cv/cv-datetime-picker/uni-datetime-picker.vue +0 -874
- package/ui-cv/cv-easyinput/uni-easyinput.vue +0 -438
- package/ui-cv/cv-fab/uni-fab.vue +0 -443
- package/ui-cv/cv-fav/uni-fav.vue +0 -136
- package/ui-cv/cv-file-picker/uni-file-picker.vue +0 -614
- package/ui-cv/cv-indexed-list/uni-indexed-list-item.vue +0 -142
- package/ui-cv/cv-indexed-list/uni-indexed-list.vue +0 -357
- package/ui-cv/cv-list/uni-list.vue +0 -107
- package/ui-cv/cv-list/uni-refresh.vue +0 -65
- package/ui-cv/cv-list-ad/uni-list-ad.vue +0 -106
- package/ui-cv/cv-list-item/uni-list-item.vue +0 -428
- package/ui-cv/cv-nav-bar/uni-nav-bar.vue +0 -244
- package/ui-cv/cv-notice-bar/uni-notice-bar.vue +0 -394
- package/ui-cv/cv-number-box/uni-number-box.vue +0 -224
- package/ui-cv/cv-pagination/uni-pagination.vue +0 -376
- package/ui-cv/cv-popup/uni-popup.vue +0 -412
- package/ui-cv/cv-popup-message/uni-popup-message.vue +0 -143
- package/ui-cv/cv-search-bar/uni-search-bar.vue +0 -262
- package/ui-cv/cv-steps/uni-steps.vue +0 -250
- package/ui-cv/cv-swiper-dot/uni-swiper-dot.vue +0 -205
- package/ui-cv/cv-table/uni-table.vue +0 -455
- package/ui-cv/cv-tag/uni-tag.vue +0 -283
- package/ui-cv/cv-tbody/uni-tbody.vue +0 -30
- package/ui-cv/cv-td/uni-td.vue +0 -88
- package/ui-cv/cv-th/uni-th.vue +0 -259
- package/ui-cv/cv-thead/uni-thead.vue +0 -114
- package/ui-cv/cv-title/uni-title.vue +0 -171
- package/ui-cv/cv-tr/uni-tr.vue +0 -156
- package/ui-cv/cv-transition/uni-transition.vue +0 -287
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef H5 -->
|
|
3
|
+
<thead class="uni-table-thead">
|
|
4
|
+
<tr class="uni-table-tr">
|
|
5
|
+
<th :rowspan="rowspan" colspan="1" class="checkbox" :class="{ 'tr-table--border': border }">
|
|
6
|
+
<table-checkbox :indeterminate="indeterminate" :checked="checked" @checkboxSelected="checkboxSelected"></table-checkbox>
|
|
7
|
+
</th>
|
|
8
|
+
</tr>
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</thead>
|
|
11
|
+
<!-- #endif -->
|
|
12
|
+
<!-- #ifndef H5 -->
|
|
13
|
+
<view class="uni-table-thead">
|
|
14
|
+
<slot></slot>
|
|
15
|
+
</view>
|
|
16
|
+
<!-- #endif -->
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import tableCheckbox from '../uni-tr/table-checkbox.vue';
|
|
21
|
+
export default {
|
|
22
|
+
name: 'cvThead',
|
|
23
|
+
components: {
|
|
24
|
+
tableCheckbox
|
|
25
|
+
},
|
|
26
|
+
options: {
|
|
27
|
+
virtualHost: true
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
border: false,
|
|
32
|
+
selection: false,
|
|
33
|
+
rowspan: 1,
|
|
34
|
+
indeterminate: false,
|
|
35
|
+
checked: false
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
created() {
|
|
39
|
+
this.root = this.getTable();
|
|
40
|
+
// #ifdef H5
|
|
41
|
+
this.root.theadChildren = this;
|
|
42
|
+
// #endif
|
|
43
|
+
this.border = this.root.border;
|
|
44
|
+
this.selection = this.root.type;
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
init(self) {
|
|
48
|
+
this.rowspan++;
|
|
49
|
+
},
|
|
50
|
+
checkboxSelected(e) {
|
|
51
|
+
this.indeterminate = false;
|
|
52
|
+
const backIndexData = this.root.backIndexData;
|
|
53
|
+
const data = this.root.trChildren.filter((v) => !v.disabled && v.keyValue);
|
|
54
|
+
if (backIndexData.length === data.length) {
|
|
55
|
+
this.checked = false;
|
|
56
|
+
this.root.clearSelection();
|
|
57
|
+
} else {
|
|
58
|
+
this.checked = true;
|
|
59
|
+
this.root.selectionAll();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* 获取父元素实例
|
|
64
|
+
*/
|
|
65
|
+
getTable(name = 'uniTable') {
|
|
66
|
+
let parent = this.$parent;
|
|
67
|
+
let parentName = parent.$options.name;
|
|
68
|
+
while (parentName !== name) {
|
|
69
|
+
parent = parent.$parent;
|
|
70
|
+
if (!parent) return false;
|
|
71
|
+
parentName = parent.$options.name;
|
|
72
|
+
}
|
|
73
|
+
return parent;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style scoped>
|
|
80
|
+
.uni-table-thead {
|
|
81
|
+
display: table-header-group;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.uni-table-tr {
|
|
85
|
+
/* #ifndef APP-NVUE */
|
|
86
|
+
display: table-row;
|
|
87
|
+
transition: all 0.3s;
|
|
88
|
+
box-sizing: border-box;
|
|
89
|
+
/* #endif */
|
|
90
|
+
border: 1px red solid;
|
|
91
|
+
background-color: #fafafa;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.checkbox {
|
|
95
|
+
padding: 0 8px;
|
|
96
|
+
width: 26px;
|
|
97
|
+
padding-left: 12px;
|
|
98
|
+
/* #ifndef APP-NVUE */
|
|
99
|
+
display: table-cell;
|
|
100
|
+
vertical-align: middle;
|
|
101
|
+
/* #endif */
|
|
102
|
+
color: #333;
|
|
103
|
+
font-weight: 500;
|
|
104
|
+
border-bottom: 1px #ebeef5 solid;
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tr-table--border {
|
|
109
|
+
border-right: 1px #ebeef5 solid;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* #ifndef APP-NVUE */
|
|
113
|
+
/* #endif */
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-title__box" :style="{ 'align-items': textAlign }">
|
|
3
|
+
<text class="uni-title__base" :class="['uni-' + type]" :style="{ color: color }">{{ title }}</text>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
/**
|
|
9
|
+
* Title 章节标题
|
|
10
|
+
* @description 章节标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题
|
|
11
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=1066
|
|
12
|
+
* @property {String} type = [h1|h2|h3|h4|h5] 标题类型
|
|
13
|
+
* @value h1 一级标题
|
|
14
|
+
* @value h2 二级标题
|
|
15
|
+
* @value h3 三级标题
|
|
16
|
+
* @value h4 四级标题
|
|
17
|
+
* @value h5 五级标题
|
|
18
|
+
* @property {String} title 章节标题内容
|
|
19
|
+
* @property {String} align = [left|center|right] 对齐方式
|
|
20
|
+
* @value left 做对齐
|
|
21
|
+
* @value center 居中对齐
|
|
22
|
+
* @value right 右对齐
|
|
23
|
+
* @property {String} color 字体颜色
|
|
24
|
+
* @property {Boolean} stat = [true|false] 是否开启统计功能呢,如不填写type值,默认为开启,填写 type 属性,默认为关闭
|
|
25
|
+
*/
|
|
26
|
+
export default {
|
|
27
|
+
name: 'cvTitle',
|
|
28
|
+
props: {
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
align: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'left'
|
|
40
|
+
},
|
|
41
|
+
color: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '#333333'
|
|
44
|
+
},
|
|
45
|
+
stat: {
|
|
46
|
+
type: [Boolean, String],
|
|
47
|
+
default: ''
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
data() {
|
|
51
|
+
return {};
|
|
52
|
+
},
|
|
53
|
+
computed: {
|
|
54
|
+
textAlign() {
|
|
55
|
+
let align = 'center';
|
|
56
|
+
switch (this.align) {
|
|
57
|
+
case 'left':
|
|
58
|
+
align = 'flex-start';
|
|
59
|
+
break;
|
|
60
|
+
case 'center':
|
|
61
|
+
align = 'center';
|
|
62
|
+
break;
|
|
63
|
+
case 'right':
|
|
64
|
+
align = 'flex-end';
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
return align;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
watch: {
|
|
71
|
+
title(newVal) {
|
|
72
|
+
if (this.isOpenStat()) {
|
|
73
|
+
// 上报数据
|
|
74
|
+
if (uni.report) {
|
|
75
|
+
uni.report('title', this.title);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
mounted() {
|
|
81
|
+
if (this.isOpenStat()) {
|
|
82
|
+
// 上报数据
|
|
83
|
+
if (uni.report) {
|
|
84
|
+
uni.report('title', this.title);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
isOpenStat() {
|
|
90
|
+
if (this.stat === '') {
|
|
91
|
+
this.isStat = false;
|
|
92
|
+
}
|
|
93
|
+
let stat_type = (typeof this.stat === 'boolean' && this.stat) || (typeof this.stat === 'string' && this.stat !== '');
|
|
94
|
+
if (this.type === '') {
|
|
95
|
+
this.isStat = true;
|
|
96
|
+
if (this.stat.toString() === 'false') {
|
|
97
|
+
this.isStat = false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (this.type !== '') {
|
|
102
|
+
this.isStat = true;
|
|
103
|
+
if (stat_type) {
|
|
104
|
+
this.isStat = true;
|
|
105
|
+
} else {
|
|
106
|
+
this.isStat = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return this.isStat;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<style scoped>
|
|
116
|
+
/* .uni-title {
|
|
117
|
+
|
|
118
|
+
} */
|
|
119
|
+
.uni-title__box {
|
|
120
|
+
/* #ifndef APP-NVUE */
|
|
121
|
+
display: flex;
|
|
122
|
+
/* #endif */
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
align-items: flex-start;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
padding: 8px 0;
|
|
127
|
+
flex: 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.uni-title__base {
|
|
131
|
+
font-size: 15px;
|
|
132
|
+
color: #333;
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.uni-h1 {
|
|
137
|
+
font-size: 20px;
|
|
138
|
+
color: #333;
|
|
139
|
+
font-weight: bold;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.uni-h2 {
|
|
143
|
+
font-size: 18px;
|
|
144
|
+
color: #333;
|
|
145
|
+
font-weight: bold;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.uni-h3 {
|
|
149
|
+
font-size: 16px;
|
|
150
|
+
color: #333;
|
|
151
|
+
font-weight: bold;
|
|
152
|
+
/* font-weight: 400; */
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.uni-h4 {
|
|
156
|
+
font-size: 14px;
|
|
157
|
+
color: #333;
|
|
158
|
+
font-weight: bold;
|
|
159
|
+
/* font-weight: 300; */
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.uni-h5 {
|
|
163
|
+
font-size: 12px;
|
|
164
|
+
color: #333;
|
|
165
|
+
font-weight: bold;
|
|
166
|
+
/* font-weight: 200; */
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef H5 -->
|
|
3
|
+
<tr class="uni-table-tr">
|
|
4
|
+
<th v-if="selection === 'selection' && ishead" class="checkbox" :class="{ 'tr-table--border': border }">
|
|
5
|
+
<table-checkbox
|
|
6
|
+
:checked="checked"
|
|
7
|
+
:indeterminate="indeterminate"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
@checkboxSelected="checkboxSelected"
|
|
10
|
+
></table-checkbox>
|
|
11
|
+
</th>
|
|
12
|
+
<slot></slot>
|
|
13
|
+
<!-- <uni-th class="th-fixed">123</uni-th> -->
|
|
14
|
+
</tr>
|
|
15
|
+
<!-- #endif -->
|
|
16
|
+
<!-- #ifndef H5 -->
|
|
17
|
+
<view class="uni-table-tr">
|
|
18
|
+
<view v-if="selection === 'selection'" class="checkbox" :class="{ 'tr-table--border': border }">
|
|
19
|
+
<table-checkbox
|
|
20
|
+
:checked="checked"
|
|
21
|
+
:indeterminate="indeterminate"
|
|
22
|
+
:disabled="disabled"
|
|
23
|
+
@checkboxSelected="checkboxSelected"
|
|
24
|
+
></table-checkbox>
|
|
25
|
+
</view>
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</view>
|
|
28
|
+
<!-- #endif -->
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import tableCheckbox from './table-checkbox.vue';
|
|
33
|
+
/**
|
|
34
|
+
* Tr 表格行组件
|
|
35
|
+
* @description 表格行组件 仅包含 th,td 组件
|
|
36
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=
|
|
37
|
+
*/
|
|
38
|
+
export default {
|
|
39
|
+
name: 'cvTr',
|
|
40
|
+
components: {
|
|
41
|
+
tableCheckbox
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
disabled: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
keyValue: {
|
|
49
|
+
type: [String, Number],
|
|
50
|
+
default: ''
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
options: {
|
|
54
|
+
virtualHost: true
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
value: false,
|
|
59
|
+
border: false,
|
|
60
|
+
selection: false,
|
|
61
|
+
widthThArr: [],
|
|
62
|
+
ishead: true,
|
|
63
|
+
checked: false,
|
|
64
|
+
indeterminate: false
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
created() {
|
|
68
|
+
this.root = this.getTable();
|
|
69
|
+
this.head = this.getTable('uniThead');
|
|
70
|
+
if (this.head) {
|
|
71
|
+
this.ishead = false;
|
|
72
|
+
this.head.init(this);
|
|
73
|
+
}
|
|
74
|
+
this.border = this.root.border;
|
|
75
|
+
this.selection = this.root.type;
|
|
76
|
+
this.root.trChildren.push(this);
|
|
77
|
+
const rowData = this.root.data.find((v) => v[this.root.rowKey] === this.keyValue);
|
|
78
|
+
if (rowData) {
|
|
79
|
+
this.rowData = rowData;
|
|
80
|
+
}
|
|
81
|
+
this.root.isNodata();
|
|
82
|
+
},
|
|
83
|
+
mounted() {
|
|
84
|
+
if (this.widthThArr.length > 0) {
|
|
85
|
+
const selectionWidth = this.selection === 'selection' ? 50 : 0;
|
|
86
|
+
this.root.minWidth = this.widthThArr.reduce((a, b) => Number(a) + Number(b)) + selectionWidth;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
// #ifndef VUE3
|
|
90
|
+
destroyed() {
|
|
91
|
+
const index = this.root.trChildren.findIndex((i) => i === this);
|
|
92
|
+
this.root.trChildren.splice(index, 1);
|
|
93
|
+
this.root.isNodata();
|
|
94
|
+
},
|
|
95
|
+
// #endif
|
|
96
|
+
// #ifdef VUE3
|
|
97
|
+
unmounted() {
|
|
98
|
+
const index = this.root.trChildren.findIndex((i) => i === this);
|
|
99
|
+
this.root.trChildren.splice(index, 1);
|
|
100
|
+
this.root.isNodata();
|
|
101
|
+
},
|
|
102
|
+
// #endif
|
|
103
|
+
methods: {
|
|
104
|
+
minWidthUpdate(width) {
|
|
105
|
+
this.widthThArr.push(width);
|
|
106
|
+
},
|
|
107
|
+
// 选中
|
|
108
|
+
checkboxSelected(e) {
|
|
109
|
+
let rootData = this.root.data.find((v) => v[this.root.rowKey] === this.keyValue);
|
|
110
|
+
this.checked = e.checked;
|
|
111
|
+
this.root.check(rootData || this, e.checked, rootData ? this.keyValue : null);
|
|
112
|
+
},
|
|
113
|
+
change(e) {
|
|
114
|
+
this.root.trChildren.forEach((item) => {
|
|
115
|
+
if (item === this) {
|
|
116
|
+
this.root.check(this, e.detail.value.length > 0 ? true : false);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* 获取父元素实例
|
|
122
|
+
*/
|
|
123
|
+
getTable(name = 'uniTable') {
|
|
124
|
+
let parent = this.$parent;
|
|
125
|
+
let parentName = parent.$options.name;
|
|
126
|
+
while (parentName !== name) {
|
|
127
|
+
parent = parent.$parent;
|
|
128
|
+
if (!parent) return false;
|
|
129
|
+
parentName = parent.$options.name;
|
|
130
|
+
}
|
|
131
|
+
return parent;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<style scoped>
|
|
138
|
+
.uni-table-tr {
|
|
139
|
+
/* #ifndef APP-NVUE */
|
|
140
|
+
display: table-row;
|
|
141
|
+
transition: all 0.3s;
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
/* #endif */
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.checkbox {
|
|
147
|
+
padding: 0 8px;
|
|
148
|
+
width: 26px;
|
|
149
|
+
padding-left: 12px;
|
|
150
|
+
/* #ifndef APP-NVUE */
|
|
151
|
+
display: table-cell;
|
|
152
|
+
vertical-align: middle;
|
|
153
|
+
/* #endif */
|
|
154
|
+
color: #333;
|
|
155
|
+
font-weight: 500;
|
|
156
|
+
border-bottom: 1px #ebeef5 solid;
|
|
157
|
+
font-size: 14px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.tr-table--border {
|
|
161
|
+
border-right: 1px #ebeef5 solid;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* #ifndef APP-NVUE */
|
|
165
|
+
/* #endif */
|
|
166
|
+
</style>
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { createAnimation } from './createAnimation';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Transition 过渡动画
|
|
12
|
+
* @description 简单过渡动画组件
|
|
13
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=985
|
|
14
|
+
* @property {Boolean} show = [false|true] 控制组件显示或隐藏
|
|
15
|
+
* @property {Array|String} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
|
|
16
|
+
* @value fade 渐隐渐出过渡
|
|
17
|
+
* @value slide-top 由上至下过渡
|
|
18
|
+
* @value slide-right 由右至左过渡
|
|
19
|
+
* @value slide-bottom 由下至上过渡
|
|
20
|
+
* @value slide-left 由左至右过渡
|
|
21
|
+
* @value zoom-in 由小到大过渡
|
|
22
|
+
* @value zoom-out 由大到小过渡
|
|
23
|
+
* @property {Number} duration 过渡动画持续时间
|
|
24
|
+
* @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
|
|
25
|
+
*/
|
|
26
|
+
export default {
|
|
27
|
+
name: 'cvTransition',
|
|
28
|
+
emits: ['click', 'change'],
|
|
29
|
+
props: {
|
|
30
|
+
show: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
modeClass: {
|
|
35
|
+
type: [Array, String],
|
|
36
|
+
default() {
|
|
37
|
+
return 'fade';
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
duration: {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 300
|
|
43
|
+
},
|
|
44
|
+
styles: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default() {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
customClass: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ''
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
data() {
|
|
56
|
+
return {
|
|
57
|
+
isShow: false,
|
|
58
|
+
transform: '',
|
|
59
|
+
opacity: 1,
|
|
60
|
+
animationData: {},
|
|
61
|
+
durationTime: 300,
|
|
62
|
+
config: {}
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
watch: {
|
|
66
|
+
show: {
|
|
67
|
+
handler(newVal) {
|
|
68
|
+
if (newVal) {
|
|
69
|
+
this.open();
|
|
70
|
+
} else {
|
|
71
|
+
// 避免上来就执行 close,导致动画错乱
|
|
72
|
+
if (this.isShow) {
|
|
73
|
+
this.close();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
immediate: true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
computed: {
|
|
81
|
+
// 生成样式数据
|
|
82
|
+
stylesObject() {
|
|
83
|
+
let styles = {
|
|
84
|
+
...this.styles,
|
|
85
|
+
'transition-duration': this.duration / 1000 + 's'
|
|
86
|
+
};
|
|
87
|
+
let transform = '';
|
|
88
|
+
for (let i in styles) {
|
|
89
|
+
let line = this.toLine(i);
|
|
90
|
+
transform += line + ':' + styles[i] + ';';
|
|
91
|
+
}
|
|
92
|
+
return transform;
|
|
93
|
+
},
|
|
94
|
+
// 初始化动画条件
|
|
95
|
+
transformStyles() {
|
|
96
|
+
return 'transform:' + this.transform + ';' + 'opacity:' + this.opacity + ';' + this.stylesObject;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
created() {
|
|
100
|
+
// 动画默认配置
|
|
101
|
+
this.config = {
|
|
102
|
+
duration: this.duration,
|
|
103
|
+
timingFunction: 'ease',
|
|
104
|
+
transformOrigin: '50% 50%',
|
|
105
|
+
delay: 0
|
|
106
|
+
};
|
|
107
|
+
this.durationTime = this.duration;
|
|
108
|
+
},
|
|
109
|
+
methods: {
|
|
110
|
+
/**
|
|
111
|
+
* ref 触发 初始化动画
|
|
112
|
+
*/
|
|
113
|
+
init(obj = {}) {
|
|
114
|
+
if (obj.duration) {
|
|
115
|
+
this.durationTime = obj.duration;
|
|
116
|
+
}
|
|
117
|
+
this.animation = createAnimation(Object.assign(this.config, obj));
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* 点击组件触发回调
|
|
121
|
+
*/
|
|
122
|
+
onClick() {
|
|
123
|
+
this.$emit('click', {
|
|
124
|
+
detail: this.isShow
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* ref 触发 动画分组
|
|
129
|
+
* @param {Object} obj
|
|
130
|
+
*/
|
|
131
|
+
step(obj, config = {}) {
|
|
132
|
+
if (!this.animation) return;
|
|
133
|
+
for (let i in obj) {
|
|
134
|
+
try {
|
|
135
|
+
if (typeof obj[i] === 'object') {
|
|
136
|
+
this.animation[i](...obj[i]);
|
|
137
|
+
} else {
|
|
138
|
+
this.animation[i](obj[i]);
|
|
139
|
+
}
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.error(`方法 ${i} 不存在`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
this.animation.step(config);
|
|
145
|
+
return this;
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* ref 触发 执行动画
|
|
149
|
+
*/
|
|
150
|
+
run(fn) {
|
|
151
|
+
if (!this.animation) return;
|
|
152
|
+
this.animation.run(fn);
|
|
153
|
+
},
|
|
154
|
+
// 开始过度动画
|
|
155
|
+
open() {
|
|
156
|
+
clearTimeout(this.timer);
|
|
157
|
+
this.transform = '';
|
|
158
|
+
this.isShow = true;
|
|
159
|
+
let { opacity, transform } = this.styleInit(false);
|
|
160
|
+
if (typeof opacity !== 'undefined') {
|
|
161
|
+
this.opacity = opacity;
|
|
162
|
+
}
|
|
163
|
+
this.transform = transform;
|
|
164
|
+
// 确保动态样式已经生效后,执行动画,如果不加 nextTick ,会导致 wx 动画执行异常
|
|
165
|
+
this.$nextTick(() => {
|
|
166
|
+
// TODO 定时器保证动画完全执行,目前有些问题,后面会取消定时器
|
|
167
|
+
this.timer = setTimeout(() => {
|
|
168
|
+
this.animation = createAnimation(this.config, this);
|
|
169
|
+
this.tranfromInit(false).step();
|
|
170
|
+
this.animation.run();
|
|
171
|
+
this.$emit('change', {
|
|
172
|
+
detail: this.isShow
|
|
173
|
+
});
|
|
174
|
+
}, 20);
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
// 关闭过度动画
|
|
178
|
+
close(type) {
|
|
179
|
+
if (!this.animation) return;
|
|
180
|
+
this.tranfromInit(true)
|
|
181
|
+
.step()
|
|
182
|
+
.run(() => {
|
|
183
|
+
this.isShow = false;
|
|
184
|
+
this.animationData = null;
|
|
185
|
+
this.animation = null;
|
|
186
|
+
let { opacity, transform } = this.styleInit(false);
|
|
187
|
+
this.opacity = opacity || 1;
|
|
188
|
+
this.transform = transform;
|
|
189
|
+
this.$emit('change', {
|
|
190
|
+
detail: this.isShow
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
// 处理动画开始前的默认样式
|
|
195
|
+
styleInit(type) {
|
|
196
|
+
let styles = {
|
|
197
|
+
transform: ''
|
|
198
|
+
};
|
|
199
|
+
let buildStyle = (type, mode) => {
|
|
200
|
+
if (mode === 'fade') {
|
|
201
|
+
styles.opacity = this.animationType(type)[mode];
|
|
202
|
+
} else {
|
|
203
|
+
styles.transform += this.animationType(type)[mode] + ' ';
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
if (typeof this.modeClass === 'string') {
|
|
207
|
+
buildStyle(type, this.modeClass);
|
|
208
|
+
} else {
|
|
209
|
+
this.modeClass.forEach((mode) => {
|
|
210
|
+
buildStyle(type, mode);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return styles;
|
|
214
|
+
},
|
|
215
|
+
// 处理内置组合动画
|
|
216
|
+
tranfromInit(type) {
|
|
217
|
+
let buildTranfrom = (type, mode) => {
|
|
218
|
+
let aniNum = null;
|
|
219
|
+
if (mode === 'fade') {
|
|
220
|
+
aniNum = type ? 0 : 1;
|
|
221
|
+
} else {
|
|
222
|
+
aniNum = type ? '-100%' : '0';
|
|
223
|
+
if (mode === 'zoom-in') {
|
|
224
|
+
aniNum = type ? 0.8 : 1;
|
|
225
|
+
}
|
|
226
|
+
if (mode === 'zoom-out') {
|
|
227
|
+
aniNum = type ? 1.2 : 1;
|
|
228
|
+
}
|
|
229
|
+
if (mode === 'slide-right') {
|
|
230
|
+
aniNum = type ? '100%' : '0';
|
|
231
|
+
}
|
|
232
|
+
if (mode === 'slide-bottom') {
|
|
233
|
+
aniNum = type ? '100%' : '0';
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
this.animation[this.animationMode()[mode]](aniNum);
|
|
237
|
+
};
|
|
238
|
+
if (typeof this.modeClass === 'string') {
|
|
239
|
+
buildTranfrom(type, this.modeClass);
|
|
240
|
+
} else {
|
|
241
|
+
this.modeClass.forEach((mode) => {
|
|
242
|
+
buildTranfrom(type, mode);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return this.animation;
|
|
247
|
+
},
|
|
248
|
+
animationType(type) {
|
|
249
|
+
return {
|
|
250
|
+
fade: type ? 1 : 0,
|
|
251
|
+
'slide-top': `translateY(${type ? '0' : '-100%'})`,
|
|
252
|
+
'slide-right': `translateX(${type ? '0' : '100%'})`,
|
|
253
|
+
'slide-bottom': `translateY(${type ? '0' : '100%'})`,
|
|
254
|
+
'slide-left': `translateX(${type ? '0' : '-100%'})`,
|
|
255
|
+
'zoom-in': `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
|
|
256
|
+
'zoom-out': `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
|
|
257
|
+
};
|
|
258
|
+
},
|
|
259
|
+
// 内置动画类型与实际动画对应字典
|
|
260
|
+
animationMode() {
|
|
261
|
+
return {
|
|
262
|
+
fade: 'opacity',
|
|
263
|
+
'slide-top': 'translateY',
|
|
264
|
+
'slide-right': 'translateX',
|
|
265
|
+
'slide-bottom': 'translateY',
|
|
266
|
+
'slide-left': 'translateX',
|
|
267
|
+
'zoom-in': 'scale',
|
|
268
|
+
'zoom-out': 'scale'
|
|
269
|
+
};
|
|
270
|
+
},
|
|
271
|
+
// 驼峰转中横线
|
|
272
|
+
toLine(name) {
|
|
273
|
+
return name.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
</script>
|
|
278
|
+
|
|
279
|
+
<style scoped></style>
|