@10yun/cv-mobile-ui 0.3.26 → 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/build/parse-pages.js +2 -2
- package/package.json +1 -1
- package/ui-cv/README.md +3 -0
- package/ui-cv/cv-badge/cv-badge.vue +249 -0
- package/ui-cv/cv-banner/cv-banner.vue +1 -1
- package/ui-cv/cv-banner-card/cv-banner-card.vue +1 -1
- package/ui-cv/cv-block/cv-block.vue +1 -1
- package/ui-cv/cv-box/cv-box.vue +1 -1
- package/ui-cv/cv-calendar/calendar.js +963 -0
- package/ui-cv/cv-calendar/cv-calendar-item.vue +198 -0
- package/ui-cv/cv-calendar/cv-calendar.vue +508 -0
- package/{ui-uni/uni-calendar → ui-cv/cv-calendar}/util.js +0 -0
- package/ui-cv/cv-card/cv-card.vue +427 -0
- package/ui-cv/cv-cell/cv-cell.vue +1 -1
- package/ui-cv/cv-checkbox-group/cv-checkbox-group.vue +227 -0
- package/ui-cv/cv-checkbox-opt-base/cv-checkbox-opt-base.vue +57 -0
- package/ui-cv/cv-checkbox-opt-tag/cv-checkbox-opt-tag.vue +107 -0
- package/ui-cv/cv-code-sms/cv-code-sms.vue +23 -42
- 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-uni/uni-data-indexed-list → ui-cv/cv-data-indexed-list}/clientdb.js +0 -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-uni/uni-data-picker → ui-cv/cv-data-picker}/keypress.js +0 -0
- package/{ui-uni/uni-data-pickerview/uni-data-picker.js → ui-cv/cv-data-pickerview/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-uni/uni-dateformat → ui-cv/cv-dateformat}/date-format.js +0 -0
- package/{ui-uni/uni-datetime-picker → ui-cv/cv-datetime-picker}/calendar-item.vue +0 -0
- package/{ui-uni/uni-datetime-picker → ui-cv/cv-datetime-picker}/calendar.js +0 -0
- package/ui-cv/cv-datetime-picker/calendar.vue +761 -0
- package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +958 -0
- package/{ui-uni/uni-datetime-picker → ui-cv/cv-datetime-picker}/keypress.js +0 -0
- package/ui-cv/cv-datetime-picker/time-picker.vue +907 -0
- package/{ui-uni/uni-datetime-picker → ui-cv/cv-datetime-picker}/util.js +0 -0
- package/ui-cv/cv-dialog-bottom/cv-dialog-bottom.vue +1 -1
- package/ui-cv/cv-dialog-full/cv-dialog-full.vue +1 -1
- package/ui-cv/cv-dialog-loading/cv-dialog-loading.vue +3 -3
- package/ui-cv/cv-drawer/cv-drawer.vue +185 -0
- package/{ui-uni/uni-drawer → ui-cv/cv-drawer}/keypress.js +14 -14
- package/{ui-uni/uni-easyinput → ui-cv/cv-easyinput}/common.js +0 -0
- package/ui-cv/cv-easyinput/cv-easyinput.vue +514 -0
- package/ui-cv/cv-editor-parse/readme.md +2 -3
- package/ui-cv/{cv-editor → cv-editor-quill}/compressImage.vue +0 -0
- package/ui-cv/{cv-editor/cv-editor.vue → cv-editor-quill/cv-editor-quill.vue} +3 -23
- package/ui-cv/{cv-editor → cv-editor-quill}/editor-icon.css +0 -0
- package/ui-cv/{cv-editor → cv-editor-quill}/editor-icon.ttf +0 -0
- package/ui-cv/{cv-editor → cv-editor-quill}/index.js +0 -0
- package/ui-cv/cv-fab/cv-fab.vue +465 -0
- package/{ui-uni/uni-fab/uni-fab.vue.bak → ui-cv/cv-fab/cv-fab.vue.bak} +2 -2
- package/ui-cv/cv-fav/cv-fav.vue +150 -0
- package/{ui-uni/uni-file-picker → ui-cv/cv-file-picker}/choose-and-upload-file.js +0 -0
- package/ui-cv/cv-file-picker/cv-file-picker.vue +619 -0
- package/{ui-uni/uni-file-picker → ui-cv/cv-file-picker}/upload-file.vue +0 -0
- package/{ui-uni/uni-file-picker → ui-cv/cv-file-picker}/upload-image.vue +0 -0
- package/{ui-uni/uni-file-picker → ui-cv/cv-file-picker}/utils.js +0 -0
- package/ui-cv/cv-form-base/cv-form-base.vue +470 -0
- package/ui-cv/cv-form-base/validate.js +477 -0
- package/ui-cv/cv-form-group/cv-form-group.vue +123 -80
- package/ui-cv/cv-form-group/cv-form-group2.vue +80 -0
- package/ui-cv/cv-form-item/cv-form-item.vue +482 -174
- package/ui-cv/cv-form-item/cv-form-item2.vue +215 -0
- package/ui-cv/cv-form-merge/cv-form-merge.vue +1 -1
- package/ui-cv/cv-geo-local/cv-geo-local.vue +14 -26
- package/{ui-uni/uni-goods-nav/uni-goods-nav.vue → ui-cv/cv-goods-nav/cv-goods-nav.vue} +1 -1
- package/ui-cv/cv-grid-group/cv-grid-group.vue +148 -0
- package/ui-cv/cv-grid-item/cv-grid-item.vue +132 -0
- package/ui-cv/cv-icon2/cv-icon2.vue +78 -0
- package/ui-cv/cv-icon2/icons.js +132 -0
- package/{ui-uni/uni-icons → ui-cv/cv-icon2}/uni.ttf +0 -0
- package/ui-cv/cv-icons/cv-icons.vue +1 -1
- 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-info/cv-info.vue +5 -20
- package/ui-cv/cv-input-btn/cv-input-btn.vue +25 -43
- package/ui-cv/cv-input-digit/cv-input-digit.vue +61 -28
- package/ui-cv/cv-input-idcard/cv-input-idcard.vue +47 -29
- package/ui-cv/cv-input-number/cv-input-number.vue +60 -28
- package/ui-cv/cv-input-password/cv-input-password.vue +80 -30
- package/ui-cv/cv-input-text/cv-input-text.vue +55 -37
- package/ui-cv/cv-link2/cv-link2.vue +130 -0
- package/ui-cv/cv-list/cv-list.vue +107 -0
- package/ui-cv/cv-list/cv-refresh.vue +65 -0
- package/{ui-uni/uni-list → ui-cv/cv-list}/uni-refresh.wxs +0 -0
- package/ui-cv/cv-list-ad/cv-list-ad.vue +113 -0
- package/{ui-uni/uni-list-chat/uni-list-chat.scss → ui-cv/cv-list-chat/cv-list-chat.scss} +0 -0
- package/{ui-uni/uni-list-chat/uni-list-chat.vue → ui-cv/cv-list-chat/cv-list-chat.vue} +0 -0
- package/ui-cv/cv-list-item/cv-list-item.vue +449 -0
- package/ui-cv/cv-load-more/config.json +9 -9
- package/ui-cv/cv-load-more/cv-load-more.vue +34 -5
- package/ui-cv/cv-message/cv-message.vue +1 -1
- package/ui-cv/cv-nav-bar/cv-nav-bar.vue +256 -0
- package/{ui-uni/uni-nav-bar/uni-status-bar.vue → ui-cv/cv-nav-bar/cv-status-bar.vue} +0 -0
- package/ui-cv/cv-nav-col/cv-nav-col.vue +1 -1
- package/ui-cv/cv-nav-row/cv-nav-row.vue +1 -1
- 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-picker-date/cv-picker-date.vue +17 -27
- package/ui-cv/cv-picker-datetime/cv-picker-datetime.vue +31 -41
- package/ui-cv/cv-picker-datetime5/cv-picker-datetime5.vue +19 -29
- package/ui-cv/cv-picker-region/cv-picker-region.vue +23 -33
- package/ui-cv/cv-picker-time/cv-picker-time.vue +16 -26
- package/ui-cv/cv-picker1/cv-picker1.vue +16 -28
- package/ui-cv/cv-picker2/cv-picker2.vue +22 -32
- package/ui-cv/cv-picker3/cv-picker3.vue +34 -44
- package/ui-cv/cv-popup/cv-popup.vue +429 -0
- package/{ui-uni/uni-popup → ui-cv/cv-popup}/keypress.js +0 -0
- package/{ui-uni/uni-popup → ui-cv/cv-popup}/popup.js +0 -0
- package/{ui-uni/uni-popup-dialog/uni-popup-dialog.vue → ui-cv/cv-popup-dialog/cv-popup-dialog.vue} +0 -0
- package/{ui-uni/uni-popup-dialog → ui-cv/cv-popup-dialog}/keypress.js +0 -0
- package/ui-cv/cv-popup-message/cv-popup-message.vue +143 -0
- package/{ui-uni/uni-popup-share/uni-popup-share.vue → ui-cv/cv-popup-share/cv-popup-share.vue} +0 -0
- package/ui-cv/cv-radio-group/cv-radio-group.vue +185 -0
- package/ui-cv/cv-radio-opt-base/cv-radio-opt-base.vue +57 -0
- package/ui-cv/cv-radio-opt-tag/cv-radio-opt-tag.vue +107 -0
- package/ui-cv/cv-rate/cv-rate.vue +13 -17
- package/ui-cv/cv-rate/uni-rate.vue +358 -0
- package/ui-cv/cv-row/cv-row.vue +157 -0
- package/ui-cv/cv-search/cv-search.vue +4 -4
- package/ui-cv/cv-search-bar/cv-search-bar.vue +280 -0
- package/{ui-uni/uni-section/uni-section.vue → ui-cv/cv-section/cv-section.vue} +0 -0
- package/{ui-uni/uni-segmented-control/uni-segmented-control.vue → ui-cv/cv-segmented-control/cv-segmented-control.vue} +0 -0
- package/ui-cv/cv-skeleton/cv-skeleton2.vue +5 -5
- package/ui-cv/cv-specs/cv-specs.vue +1 -1
- package/{ui-uni/uni-status-bar/uni-status-bar.vue → ui-cv/cv-status-bar/cv-status-bar.vue} +0 -0
- package/ui-cv/cv-steps/cv-steps.vue +293 -0
- package/{ui-uni/uni-swipe-action/uni-swipe-action.vue → ui-cv/cv-swipe-action/cv-swipe-action.vue} +0 -0
- package/{ui-uni/uni-swipe-action-item → ui-cv/cv-swipe-action-item}/bindingx.js +0 -0
- package/{ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue → ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue} +0 -0
- package/{ui-uni/uni-swipe-action-item → ui-cv/cv-swipe-action-item}/index.wxs +0 -0
- package/{ui-uni/uni-swipe-action-item → ui-cv/cv-swipe-action-item}/isPC.js +0 -0
- package/{ui-uni/uni-swipe-action-item → ui-cv/cv-swipe-action-item}/mpalipay.js +0 -0
- package/{ui-uni/uni-swipe-action-item → ui-cv/cv-swipe-action-item}/mpother.js +0 -0
- package/{ui-uni/uni-swipe-action-item → ui-cv/cv-swipe-action-item}/mpwxs.js +0 -0
- package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +255 -0
- package/ui-cv/cv-switch/cv-switch.vue +5 -9
- 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-uni/uni-test/uni-test.vue → ui-cv/cv-test/cv-test.vue} +0 -0
- package/ui-cv/cv-textarea/cv-textarea.vue +56 -41
- package/ui-cv/cv-th/cv-th.vue +270 -0
- package/{ui-uni/uni-th → ui-cv/cv-th}/filter-dropdown.vue +0 -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-uni/uni-tr → ui-cv/cv-tr}/table-checkbox.vue +0 -0
- package/{ui-uni/uni-transition → ui-cv/cv-transition}/createAnimation.js +0 -0
- package/ui-cv/cv-transition/cv-transition.vue +279 -0
- package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +24 -22
- package/ui-cv/cv-upload-img/cv-upload-img.vue +1 -1
- package/ui-cv/mixins/mixins-input.js +20 -29
- package/ui-cv/mixins/mixins-picker.js +1 -13
- package/ui-uni/amap-wx/js/util.js +158 -166
- package/ui-uni/product.vue +52 -52
- package/ui-uni/u-charts/u-charts.js +1092 -743
- package/ui-cv/cv-checkbox/cv-checkbox.vue +0 -140
- package/ui-cv/cv-checkbox-tag/cv-checkbox-tag.vue +0 -164
- package/ui-cv/cv-nav-group/cv-nav-group.vue +0 -33
- package/ui-cv/cv-radio/cv-radio.vue +0 -111
- package/ui-cv/cv-radio-sex/cv-radio-sex.vue +0 -80
- package/ui-cv/cv-radio-tag/cv-radio-tag.vue +0 -133
- package/ui-cv/mixins/mixins-checkbox.js +0 -71
- package/ui-cv/mixins/mixins-common.js +0 -53
- package/ui-cv/mixins/mixins-radio.js +0 -84
- package/ui-uni/page-foot/page-foot.vue +0 -38
- package/ui-uni/page-head/page-head.vue +0 -16
- package/ui-uni/u-link/u-link.vue +0 -59
- package/ui-uni/uni-badge/uni-badge.vue +0 -250
- package/ui-uni/uni-calendar/calendar.js +0 -546
- package/ui-uni/uni-calendar/uni-calendar-item.vue +0 -171
- package/ui-uni/uni-calendar/uni-calendar.vue +0 -504
- package/ui-uni/uni-card/uni-card.vue +0 -420
- package/ui-uni/uni-col/uni-col.vue +0 -2968
- package/ui-uni/uni-collapse/uni-collapse.vue +0 -146
- package/ui-uni/uni-collapse-item/uni-collapse-item.vue +0 -378
- package/ui-uni/uni-combox/uni-combox.vue +0 -237
- package/ui-uni/uni-countdown/uni-countdown.vue +0 -234
- package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +0 -792
- package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +0 -142
- package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +0 -364
- package/ui-uni/uni-data-picker/uni-data-picker.vue +0 -468
- package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +0 -298
- package/ui-uni/uni-dateformat/uni-dateformat.vue +0 -88
- package/ui-uni/uni-datetime-picker/calendar.vue +0 -747
- package/ui-uni/uni-datetime-picker/time-picker.vue +0 -899
- package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +0 -874
- package/ui-uni/uni-drawer/uni-drawer.vue +0 -178
- package/ui-uni/uni-easyinput/uni-easyinput.vue +0 -438
- package/ui-uni/uni-fab/uni-fab.vue +0 -443
- package/ui-uni/uni-fav/uni-fav.vue +0 -136
- package/ui-uni/uni-file-picker/uni-file-picker.vue +0 -614
- package/ui-uni/uni-forms/uni-forms.vue +0 -467
- package/ui-uni/uni-forms/validate.js +0 -486
- package/ui-uni/uni-forms-item/uni-forms-item.vue +0 -500
- package/ui-uni/uni-grid/uni-grid.vue +0 -141
- package/ui-uni/uni-grid-item/uni-grid-item.vue +0 -123
- package/ui-uni/uni-group/uni-group.vue +0 -123
- package/ui-uni/uni-icons/icons.js +0 -132
- package/ui-uni/uni-icons/uni-icons.vue +0 -72
- package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +0 -142
- package/ui-uni/uni-indexed-list/uni-indexed-list.vue +0 -357
- package/ui-uni/uni-link/uni-link.vue +0 -117
- package/ui-uni/uni-list/uni-list.vue +0 -107
- package/ui-uni/uni-list/uni-refresh.vue +0 -65
- package/ui-uni/uni-list-ad/uni-list-ad.vue +0 -106
- package/ui-uni/uni-list-item/uni-list-item.vue +0 -428
- package/ui-uni/uni-load-more/uni-load-more.vue +0 -366
- package/ui-uni/uni-nav-bar/uni-nav-bar.vue +0 -244
- package/ui-uni/uni-notice-bar/uni-notice-bar.vue +0 -394
- package/ui-uni/uni-number-box/uni-number-box.vue +0 -224
- package/ui-uni/uni-pagination/uni-pagination.vue +0 -376
- package/ui-uni/uni-popup/uni-popup.vue +0 -412
- package/ui-uni/uni-popup-message/uni-popup-message.vue +0 -143
- package/ui-uni/uni-rate/uni-rate.vue +0 -357
- package/ui-uni/uni-row/uni-row.vue +0 -155
- package/ui-uni/uni-search-bar/uni-search-bar.vue +0 -262
- package/ui-uni/uni-steps/uni-steps.vue +0 -250
- package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +0 -205
- package/ui-uni/uni-table/uni-table.vue +0 -455
- package/ui-uni/uni-tag/uni-tag.vue +0 -283
- package/ui-uni/uni-tbody/uni-tbody.vue +0 -30
- package/ui-uni/uni-td/uni-td.vue +0 -88
- package/ui-uni/uni-th/uni-th.vue +0 -259
- package/ui-uni/uni-thead/uni-thead.vue +0 -114
- package/ui-uni/uni-title/uni-title.vue +0 -171
- package/ui-uni/uni-tr/uni-tr.vue +0 -156
- package/ui-uni/uni-transition/uni-transition.vue +0 -287
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-collapse">
|
|
3
|
+
<slot />
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
/**
|
|
8
|
+
* Collapse 折叠面板
|
|
9
|
+
* @description 展示可以折叠 / 展开的内容区域
|
|
10
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=23
|
|
11
|
+
* @property {String|Array} value 当前激活面板改变时触发(如果是手风琴模式,参数类型为string,否则为array)
|
|
12
|
+
* @property {Boolean} accordion = [true|false] 是否开启手风琴效果是否开启手风琴效果
|
|
13
|
+
* @event {Function} change 切换面板时触发,如果是手风琴模式,返回类型为string,否则为array
|
|
14
|
+
*/
|
|
15
|
+
export default {
|
|
16
|
+
name: 'cvCollapse',
|
|
17
|
+
emits: ['change', 'activeItem', 'input', 'update:modelValue'],
|
|
18
|
+
props: {
|
|
19
|
+
value: {
|
|
20
|
+
type: [String, Array],
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: [String, Array],
|
|
25
|
+
default: ''
|
|
26
|
+
},
|
|
27
|
+
accordion: {
|
|
28
|
+
// 是否开启手风琴效果
|
|
29
|
+
type: [Boolean, String],
|
|
30
|
+
default: false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
data() {
|
|
34
|
+
return {};
|
|
35
|
+
},
|
|
36
|
+
computed: {
|
|
37
|
+
// TODO 兼容 vue2 和 vue3
|
|
38
|
+
dataValue() {
|
|
39
|
+
let value = (typeof this.value === 'string' && this.value === '') || (Array.isArray(this.value) && this.value.length === 0);
|
|
40
|
+
let modelValue =
|
|
41
|
+
(typeof this.modelValue === 'string' && this.modelValue === '') ||
|
|
42
|
+
(Array.isArray(this.modelValue) && this.modelValue.length === 0);
|
|
43
|
+
if (value) {
|
|
44
|
+
return this.modelValue;
|
|
45
|
+
}
|
|
46
|
+
if (modelValue) {
|
|
47
|
+
return this.value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return this.value;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
watch: {
|
|
54
|
+
dataValue(val) {
|
|
55
|
+
this.setOpen(val);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
created() {
|
|
59
|
+
this.childrens = [];
|
|
60
|
+
this.names = [];
|
|
61
|
+
},
|
|
62
|
+
mounted() {
|
|
63
|
+
this.setOpen(this.dataValue);
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
setOpen(val) {
|
|
67
|
+
let str = typeof val === 'string';
|
|
68
|
+
let arr = Array.isArray(val);
|
|
69
|
+
|
|
70
|
+
this.childrens.forEach((vm, index) => {
|
|
71
|
+
if (str) {
|
|
72
|
+
if (val === vm.nameSync) {
|
|
73
|
+
if (!this.accordion) {
|
|
74
|
+
console.warn('accordion 属性为 false ,v-model 类型应该为 array');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
vm.isOpen = true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (arr) {
|
|
81
|
+
val.forEach((v) => {
|
|
82
|
+
if (v === vm.nameSync) {
|
|
83
|
+
if (this.accordion) {
|
|
84
|
+
console.warn('accordion 属性为 true ,v-model 类型应该为 string');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
vm.isOpen = true;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
this.emit(val);
|
|
93
|
+
},
|
|
94
|
+
setAccordion(self) {
|
|
95
|
+
if (!this.accordion) return;
|
|
96
|
+
this.childrens.forEach((vm, index) => {
|
|
97
|
+
if (self !== vm) {
|
|
98
|
+
vm.isOpen = false;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
resize() {
|
|
103
|
+
this.childrens.forEach((vm, index) => {
|
|
104
|
+
// #ifndef APP-NVUE
|
|
105
|
+
vm.getCollapseHeight();
|
|
106
|
+
// #endif
|
|
107
|
+
// #ifdef APP-NVUE
|
|
108
|
+
vm.getNvueHwight();
|
|
109
|
+
// #endif
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
onChange(isOpen, self) {
|
|
113
|
+
let activeItem = [];
|
|
114
|
+
|
|
115
|
+
if (this.accordion) {
|
|
116
|
+
activeItem = isOpen ? self.nameSync : '';
|
|
117
|
+
} else {
|
|
118
|
+
this.childrens.forEach((vm, index) => {
|
|
119
|
+
if (vm.isOpen) {
|
|
120
|
+
activeItem.push(vm.nameSync);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
this.$emit('change', activeItem);
|
|
125
|
+
this.emit(activeItem);
|
|
126
|
+
},
|
|
127
|
+
emit(val) {
|
|
128
|
+
this.$emit('input', val);
|
|
129
|
+
this.$emit('update:modelValue', val);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
</script>
|
|
134
|
+
<style scoped>
|
|
135
|
+
.uni-collapse {
|
|
136
|
+
/* #ifndef APP-NVUE */
|
|
137
|
+
width: 100%;
|
|
138
|
+
display: flex;
|
|
139
|
+
/* #endif */
|
|
140
|
+
/* #ifdef APP-NVUE */
|
|
141
|
+
flex: 1;
|
|
142
|
+
/* #endif */
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
background-color: #ffffff;
|
|
145
|
+
}
|
|
146
|
+
</style>
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-collapse-item">
|
|
3
|
+
<!-- onClick(!isOpen) -->
|
|
4
|
+
<view
|
|
5
|
+
@click="onClick(!isOpen)"
|
|
6
|
+
class="uni-collapse-item__title"
|
|
7
|
+
:class="{ 'is-open': isOpen && titleBorder === 'auto', 'uni-collapse-item-border': titleBorder !== 'none' }"
|
|
8
|
+
>
|
|
9
|
+
<view class="uni-collapse-item__title-wrap">
|
|
10
|
+
<slot name="title">
|
|
11
|
+
<view class="uni-collapse-item__title-box" :class="{ 'is-disabled': disabled }">
|
|
12
|
+
<image v-if="thumb" :src="thumb" class="uni-collapse-item__title-img" />
|
|
13
|
+
<text class="uni-collapse-item__title-text">{{ title }}</text>
|
|
14
|
+
</view>
|
|
15
|
+
</slot>
|
|
16
|
+
</view>
|
|
17
|
+
<view
|
|
18
|
+
:class="{ 'uni-collapse-item__title-arrow-active': isOpen, 'uni-collapse-item--animation': showAnimation === true }"
|
|
19
|
+
class="uni-collapse-item__title-arrow"
|
|
20
|
+
>
|
|
21
|
+
<cv-icon2 :color="disabled ? '#ddd' : '#bbb'" size="14" type="arrowdown" />
|
|
22
|
+
</view>
|
|
23
|
+
</view>
|
|
24
|
+
<view
|
|
25
|
+
class="uni-collapse-item__wrap"
|
|
26
|
+
:class="{ 'is--transition': showAnimation }"
|
|
27
|
+
:style="{ height: (isOpen ? height : 0) + 'px' }"
|
|
28
|
+
>
|
|
29
|
+
<view
|
|
30
|
+
:id="elId"
|
|
31
|
+
ref="collapse--hook"
|
|
32
|
+
class="uni-collapse-item__wrap-content"
|
|
33
|
+
:class="{ open: isheight, 'uni-collapse-item--border': border && isOpen }"
|
|
34
|
+
>
|
|
35
|
+
<slot></slot>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
// #ifdef APP-NVUE
|
|
43
|
+
const dom = weex.requireModule('dom');
|
|
44
|
+
// #endif
|
|
45
|
+
/**
|
|
46
|
+
* CollapseItem 折叠面板子组件
|
|
47
|
+
* @description 折叠面板子组件
|
|
48
|
+
* @property {String} title 标题文字
|
|
49
|
+
* @property {String} thumb 标题左侧缩略图
|
|
50
|
+
* @property {String} name 唯一标志符
|
|
51
|
+
* @property {Boolean} disabled = [true|false] 是否展开面板
|
|
52
|
+
* @property {Boolean} showAnimation = [true|false] 开启动画
|
|
53
|
+
*/
|
|
54
|
+
export default {
|
|
55
|
+
name: 'cvCollapseItem',
|
|
56
|
+
props: {
|
|
57
|
+
// 列表标题
|
|
58
|
+
title: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: ''
|
|
61
|
+
},
|
|
62
|
+
name: {
|
|
63
|
+
type: [Number, String],
|
|
64
|
+
default: ''
|
|
65
|
+
},
|
|
66
|
+
// 是否禁用
|
|
67
|
+
disabled: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
// #ifdef APP-PLUS
|
|
72
|
+
// 是否显示动画,app 端默认不开启动画,卡顿严重
|
|
73
|
+
showAnimation: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
// #endif
|
|
78
|
+
// #ifndef APP-PLUS
|
|
79
|
+
// 是否显示动画
|
|
80
|
+
showAnimation: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: true
|
|
83
|
+
},
|
|
84
|
+
// #endif
|
|
85
|
+
// 是否展开
|
|
86
|
+
open: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
90
|
+
// 缩略图
|
|
91
|
+
thumb: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: ''
|
|
94
|
+
},
|
|
95
|
+
// 标题分隔线显示类型
|
|
96
|
+
titleBorder: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: 'auto'
|
|
99
|
+
},
|
|
100
|
+
// 是否显示分隔线
|
|
101
|
+
border: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: true
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
data() {
|
|
107
|
+
// TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
|
|
108
|
+
const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`;
|
|
109
|
+
return {
|
|
110
|
+
isOpen: false,
|
|
111
|
+
isheight: null,
|
|
112
|
+
height: 0,
|
|
113
|
+
elId,
|
|
114
|
+
nameSync: 0
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
watch: {
|
|
118
|
+
open(val) {
|
|
119
|
+
this.isOpen = val;
|
|
120
|
+
this.onClick(val, 'init');
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
updated(e) {
|
|
124
|
+
this.$nextTick(() => {
|
|
125
|
+
this.init(true);
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
created() {
|
|
129
|
+
this.collapse = this.getCollapse();
|
|
130
|
+
this.oldHeight = 0;
|
|
131
|
+
},
|
|
132
|
+
// #ifndef VUE3
|
|
133
|
+
// TODO vue2
|
|
134
|
+
destroyed() {
|
|
135
|
+
if (this.__isUnmounted) return;
|
|
136
|
+
this.uninstall();
|
|
137
|
+
},
|
|
138
|
+
// #endif
|
|
139
|
+
// #ifdef VUE3
|
|
140
|
+
// TODO vue3
|
|
141
|
+
unmounted() {
|
|
142
|
+
this.__isUnmounted = true;
|
|
143
|
+
this.uninstall();
|
|
144
|
+
},
|
|
145
|
+
// #endif
|
|
146
|
+
|
|
147
|
+
mounted() {
|
|
148
|
+
if (!this.collapse) return;
|
|
149
|
+
if (this.name !== '') {
|
|
150
|
+
this.nameSync = this.name;
|
|
151
|
+
} else {
|
|
152
|
+
this.nameSync = this.collapse.childrens.length + '';
|
|
153
|
+
}
|
|
154
|
+
if (this.collapse.names.indexOf(this.nameSync) === -1) {
|
|
155
|
+
this.collapse.names.push(this.nameSync);
|
|
156
|
+
} else {
|
|
157
|
+
console.warn(`name 值 ${this.nameSync} 重复`);
|
|
158
|
+
}
|
|
159
|
+
if (this.collapse.childrens.indexOf(this) === -1) {
|
|
160
|
+
this.collapse.childrens.push(this);
|
|
161
|
+
}
|
|
162
|
+
this.init();
|
|
163
|
+
},
|
|
164
|
+
methods: {
|
|
165
|
+
init(type) {
|
|
166
|
+
// #ifndef APP-NVUE
|
|
167
|
+
this.getCollapseHeight(type);
|
|
168
|
+
// #endif
|
|
169
|
+
// #ifdef APP-NVUE
|
|
170
|
+
this.getNvueHwight(type);
|
|
171
|
+
// #endif
|
|
172
|
+
},
|
|
173
|
+
uninstall() {
|
|
174
|
+
if (this.collapse) {
|
|
175
|
+
this.collapse.childrens.forEach((item, index) => {
|
|
176
|
+
if (item === this) {
|
|
177
|
+
this.collapse.childrens.splice(index, 1);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
this.collapse.names.forEach((item, index) => {
|
|
181
|
+
if (item === this.nameSync) {
|
|
182
|
+
this.collapse.names.splice(index, 1);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
onClick(isOpen, type) {
|
|
188
|
+
if (this.disabled) return;
|
|
189
|
+
this.isOpen = isOpen;
|
|
190
|
+
if (this.isOpen && this.collapse) {
|
|
191
|
+
this.collapse.setAccordion(this);
|
|
192
|
+
}
|
|
193
|
+
if (type !== 'init') {
|
|
194
|
+
this.collapse.onChange(isOpen, this);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
getCollapseHeight(type, index = 0) {
|
|
198
|
+
const views = uni.createSelectorQuery().in(this);
|
|
199
|
+
views
|
|
200
|
+
.select(`#${this.elId}`)
|
|
201
|
+
.fields(
|
|
202
|
+
{
|
|
203
|
+
size: true
|
|
204
|
+
},
|
|
205
|
+
(data) => {
|
|
206
|
+
// TODO 百度中可能获取不到节点信息 ,需要循环获取
|
|
207
|
+
if (index >= 10) return;
|
|
208
|
+
if (!data) {
|
|
209
|
+
index++;
|
|
210
|
+
this.getCollapseHeight(false, index);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
// #ifdef APP-NVUE
|
|
214
|
+
this.height = data.height + 1;
|
|
215
|
+
// #endif
|
|
216
|
+
// #ifndef APP-NVUE
|
|
217
|
+
this.height = data.height;
|
|
218
|
+
// #endif
|
|
219
|
+
this.isheight = true;
|
|
220
|
+
if (type) return;
|
|
221
|
+
this.onClick(this.open, 'init');
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
.exec();
|
|
225
|
+
},
|
|
226
|
+
getNvueHwight(type) {
|
|
227
|
+
const result = dom.getComponentRect(this.$refs['collapse--hook'], (option) => {
|
|
228
|
+
if (option && option.result && option.size) {
|
|
229
|
+
// #ifdef APP-NVUE
|
|
230
|
+
this.height = option.size.height + 1;
|
|
231
|
+
// #endif
|
|
232
|
+
// #ifndef APP-NVUE
|
|
233
|
+
this.height = option.size.height;
|
|
234
|
+
// #endif
|
|
235
|
+
this.isheight = true;
|
|
236
|
+
if (type) return;
|
|
237
|
+
this.onClick(this.open, 'init');
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
/**
|
|
242
|
+
* 获取父元素实例
|
|
243
|
+
*/
|
|
244
|
+
getCollapse(name = 'uniCollapse') {
|
|
245
|
+
let parent = this.$parent;
|
|
246
|
+
let parentName = parent.$options.name;
|
|
247
|
+
while (parentName !== name) {
|
|
248
|
+
parent = parent.$parent;
|
|
249
|
+
if (!parent) return false;
|
|
250
|
+
parentName = parent.$options.name;
|
|
251
|
+
}
|
|
252
|
+
return parent;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
</script>
|
|
257
|
+
|
|
258
|
+
<style scoped>
|
|
259
|
+
.uni-collapse-item {
|
|
260
|
+
/* #ifndef APP-NVUE */
|
|
261
|
+
box-sizing: border-box;
|
|
262
|
+
/* #endif */
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.uni-collapse-item__title {
|
|
266
|
+
/* #ifndef APP-NVUE */
|
|
267
|
+
display: flex;
|
|
268
|
+
width: 100%;
|
|
269
|
+
box-sizing: border-box;
|
|
270
|
+
/* #endif */
|
|
271
|
+
flex-direction: row;
|
|
272
|
+
align-items: center;
|
|
273
|
+
transition: border-bottom-color 0.3s;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.uni-collapse-item__title-wrap {
|
|
277
|
+
width: 100%;
|
|
278
|
+
flex: 1;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.uni-collapse-item__title-box {
|
|
282
|
+
padding: 0 15px;
|
|
283
|
+
/* #ifndef APP-NVUE */
|
|
284
|
+
display: flex;
|
|
285
|
+
width: 100%;
|
|
286
|
+
box-sizing: border-box;
|
|
287
|
+
/* #endif */
|
|
288
|
+
flex-direction: row;
|
|
289
|
+
justify-content: space-between;
|
|
290
|
+
align-items: center;
|
|
291
|
+
height: 48px;
|
|
292
|
+
line-height: 48px;
|
|
293
|
+
background-color: #fff;
|
|
294
|
+
color: #303133;
|
|
295
|
+
font-size: 13px;
|
|
296
|
+
font-weight: 500;
|
|
297
|
+
/* #ifdef H5 */
|
|
298
|
+
cursor: pointer;
|
|
299
|
+
outline: none;
|
|
300
|
+
/* #endif */
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.uni-collapse-item__title-box.is-disabled .uni-collapse-item__title-text {
|
|
304
|
+
color: #c0c0c0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.uni-collapse-item__title.uni-collapse-item-border {
|
|
308
|
+
border-bottom: 1px solid #ebeef5;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.uni-collapse-item__title.is-open {
|
|
312
|
+
border-bottom-color: transparent;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.uni-collapse-item__title-img {
|
|
316
|
+
height: 26px;
|
|
317
|
+
width: 26px;
|
|
318
|
+
margin-right: 10px;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.uni-collapse-item__title-text {
|
|
322
|
+
flex: 1;
|
|
323
|
+
font-size: 14px;
|
|
324
|
+
/* #ifndef APP-NVUE */
|
|
325
|
+
white-space: nowrap;
|
|
326
|
+
color: inherit;
|
|
327
|
+
/* #endif */
|
|
328
|
+
/* #ifdef APP-NVUE */
|
|
329
|
+
lines: 1;
|
|
330
|
+
/* #endif */
|
|
331
|
+
overflow: hidden;
|
|
332
|
+
text-overflow: ellipsis;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.uni-collapse-item__title-arrow {
|
|
336
|
+
/* #ifndef APP-NVUE */
|
|
337
|
+
display: flex;
|
|
338
|
+
box-sizing: border-box;
|
|
339
|
+
/* #endif */
|
|
340
|
+
align-items: center;
|
|
341
|
+
justify-content: center;
|
|
342
|
+
width: 20px;
|
|
343
|
+
height: 20px;
|
|
344
|
+
margin-right: 10px;
|
|
345
|
+
transform: rotate(0deg);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.uni-collapse-item__title-arrow-active {
|
|
349
|
+
transform: rotate(180deg);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.uni-collapse-item__wrap {
|
|
353
|
+
/* #ifndef APP-NVUE */
|
|
354
|
+
will-change: height;
|
|
355
|
+
box-sizing: border-box;
|
|
356
|
+
/* #endif */
|
|
357
|
+
background-color: #fff;
|
|
358
|
+
overflow: hidden;
|
|
359
|
+
position: relative;
|
|
360
|
+
height: 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.uni-collapse-item__wrap.is--transition {
|
|
364
|
+
transition-property: height, border-bottom-width;
|
|
365
|
+
transition-duration: 0.3s;
|
|
366
|
+
/* #ifndef APP-NVUE */
|
|
367
|
+
will-change: height;
|
|
368
|
+
/* #endif */
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.uni-collapse-item__wrap-content {
|
|
372
|
+
position: absolute;
|
|
373
|
+
font-size: 13px;
|
|
374
|
+
color: #303133;
|
|
375
|
+
border-bottom-color: transparent;
|
|
376
|
+
border-bottom-style: solid;
|
|
377
|
+
border-bottom-width: 0;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.uni-collapse-item__wrap-content.uni-collapse-item--border {
|
|
381
|
+
border-bottom-width: 1px;
|
|
382
|
+
border-bottom-color: red;
|
|
383
|
+
border-bottom-color: #ebeef5;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.uni-collapse-item__wrap-content.open {
|
|
387
|
+
position: relative;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.uni-collapse-item--animation {
|
|
391
|
+
transition-property: transform;
|
|
392
|
+
transition-duration: 0.3s;
|
|
393
|
+
transition-timing-function: ease;
|
|
394
|
+
}
|
|
395
|
+
</style>
|