@10yun/cv-mobile-ui 0.4.2 → 0.4.4

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.
Files changed (168) hide show
  1. package/package.json +1 -1
  2. package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
  3. package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
  4. package/ui-uni/amap-wx/js/util.js +166 -158
  5. package/ui-uni/page-foot/page-foot.vue +38 -0
  6. package/ui-uni/page-head/page-head.vue +16 -0
  7. package/ui-uni/product.vue +52 -52
  8. package/ui-uni/u-charts/u-charts.js +743 -1092
  9. package/ui-uni/u-link/u-link.vue +59 -0
  10. package/ui-uni/uni-badge/uni-badge.vue +250 -0
  11. package/ui-uni/uni-calendar/calendar.js +546 -0
  12. package/ui-uni/uni-calendar/uni-calendar-item.vue +171 -0
  13. package/ui-uni/uni-calendar/uni-calendar.vue +504 -0
  14. package/{ui-cv/cv-calendar → ui-uni/uni-calendar}/util.js +0 -0
  15. package/ui-uni/uni-card/uni-card.vue +420 -0
  16. package/ui-uni/uni-col/uni-col.vue +2968 -0
  17. package/ui-uni/uni-collapse/uni-collapse.vue +146 -0
  18. package/ui-uni/uni-collapse-item/uni-collapse-item.vue +378 -0
  19. package/ui-uni/uni-combox/uni-combox.vue +237 -0
  20. package/ui-uni/uni-countdown/uni-countdown.vue +234 -0
  21. package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +792 -0
  22. package/{ui-cv/cv-data-indexed-list → ui-uni/uni-data-indexed-list}/clientdb.js +0 -0
  23. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +142 -0
  24. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +364 -0
  25. package/{ui-cv/cv-data-picker → ui-uni/uni-data-picker}/keypress.js +0 -0
  26. package/ui-uni/uni-data-picker/uni-data-picker.vue +468 -0
  27. package/{ui-cv/cv-data-pickerview/cv-data-picker.js → ui-uni/uni-data-pickerview/uni-data-picker.js} +0 -0
  28. package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +298 -0
  29. package/{ui-cv/cv-dateformat → ui-uni/uni-dateformat}/date-format.js +0 -0
  30. package/ui-uni/uni-dateformat/uni-dateformat.vue +88 -0
  31. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar-item.vue +0 -0
  32. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar.js +0 -0
  33. package/ui-uni/uni-datetime-picker/calendar.vue +747 -0
  34. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/keypress.js +0 -0
  35. package/ui-uni/uni-datetime-picker/time-picker.vue +899 -0
  36. package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +874 -0
  37. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/util.js +0 -0
  38. package/ui-uni/uni-drawer/keypress.js +45 -0
  39. package/ui-uni/uni-drawer/uni-drawer.vue +178 -0
  40. package/{ui-cv/cv-easyinput → ui-uni/uni-easyinput}/common.js +0 -0
  41. package/ui-uni/uni-easyinput/uni-easyinput.vue +438 -0
  42. package/ui-uni/uni-fab/uni-fab.vue +443 -0
  43. package/{ui-cv/cv-fab/cv-fab.vue.bak → ui-uni/uni-fab/uni-fab.vue.bak} +2 -2
  44. package/ui-uni/uni-fav/uni-fav.vue +136 -0
  45. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/choose-and-upload-file.js +0 -0
  46. package/ui-uni/uni-file-picker/uni-file-picker.vue +614 -0
  47. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-file.vue +0 -0
  48. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-image.vue +0 -0
  49. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/utils.js +0 -0
  50. package/ui-uni/uni-forms/uni-forms.vue +467 -0
  51. package/ui-uni/uni-forms/validate.js +486 -0
  52. package/ui-uni/uni-forms-item/uni-forms-item.vue +500 -0
  53. package/{ui-cv/cv-goods-nav/cv-goods-nav.vue → ui-uni/uni-goods-nav/uni-goods-nav.vue} +1 -1
  54. package/ui-uni/uni-grid/uni-grid.vue +141 -0
  55. package/ui-uni/uni-grid-item/uni-grid-item.vue +123 -0
  56. package/ui-uni/uni-group/uni-group.vue +123 -0
  57. package/ui-uni/uni-icons/icons.js +132 -0
  58. package/ui-uni/uni-icons/uni-icons.vue +72 -0
  59. package/{ui-cv/cv-icon2 → ui-uni/uni-icons}/uni.ttf +0 -0
  60. package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +142 -0
  61. package/ui-uni/uni-indexed-list/uni-indexed-list.vue +357 -0
  62. package/ui-uni/uni-link/uni-link.vue +117 -0
  63. package/ui-uni/uni-list/uni-list.vue +107 -0
  64. package/ui-uni/uni-list/uni-refresh.vue +65 -0
  65. package/{ui-cv/cv-list → ui-uni/uni-list}/uni-refresh.wxs +0 -0
  66. package/ui-uni/uni-list-ad/uni-list-ad.vue +106 -0
  67. package/{ui-cv/cv-list-chat/cv-list-chat.scss → ui-uni/uni-list-chat/uni-list-chat.scss} +0 -0
  68. package/{ui-cv/cv-list-chat/cv-list-chat.vue → ui-uni/uni-list-chat/uni-list-chat.vue} +0 -0
  69. package/ui-uni/uni-list-item/uni-list-item.vue +428 -0
  70. package/ui-uni/uni-load-more/uni-load-more.vue +366 -0
  71. package/ui-uni/uni-nav-bar/uni-nav-bar.vue +244 -0
  72. package/{ui-cv/cv-nav-bar/cv-status-bar.vue → ui-uni/uni-nav-bar/uni-status-bar.vue} +0 -0
  73. package/ui-uni/uni-notice-bar/uni-notice-bar.vue +394 -0
  74. package/ui-uni/uni-number-box/uni-number-box.vue +224 -0
  75. package/ui-uni/uni-pagination/uni-pagination.vue +376 -0
  76. package/{ui-cv/cv-popup → ui-uni/uni-popup}/keypress.js +0 -0
  77. package/{ui-cv/cv-popup → ui-uni/uni-popup}/popup.js +0 -0
  78. package/ui-uni/uni-popup/uni-popup.vue +412 -0
  79. package/{ui-cv/cv-popup-dialog → ui-uni/uni-popup-dialog}/keypress.js +0 -0
  80. package/{ui-cv/cv-popup-dialog/cv-popup-dialog.vue → ui-uni/uni-popup-dialog/uni-popup-dialog.vue} +0 -0
  81. package/ui-uni/uni-popup-message/uni-popup-message.vue +143 -0
  82. package/{ui-cv/cv-popup-share/cv-popup-share.vue → ui-uni/uni-popup-share/uni-popup-share.vue} +0 -0
  83. package/ui-uni/uni-rate/uni-rate.vue +357 -0
  84. package/ui-uni/uni-row/uni-row.vue +155 -0
  85. package/ui-uni/uni-search-bar/uni-search-bar.vue +262 -0
  86. package/{ui-cv/cv-section/cv-section.vue → ui-uni/uni-section/uni-section.vue} +0 -0
  87. package/{ui-cv/cv-segmented-control/cv-segmented-control.vue → ui-uni/uni-segmented-control/uni-segmented-control.vue} +0 -0
  88. package/{ui-cv/cv-status-bar/cv-status-bar.vue → ui-uni/uni-status-bar/uni-status-bar.vue} +0 -0
  89. package/ui-uni/uni-steps/uni-steps.vue +250 -0
  90. package/{ui-cv/cv-swipe-action/cv-swipe-action.vue → ui-uni/uni-swipe-action/uni-swipe-action.vue} +0 -0
  91. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/bindingx.js +0 -0
  92. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/index.wxs +0 -0
  93. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/isPC.js +0 -0
  94. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpalipay.js +0 -0
  95. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpother.js +0 -0
  96. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpwxs.js +0 -0
  97. package/{ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue → ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue} +0 -0
  98. package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +205 -0
  99. package/ui-uni/uni-table/uni-table.vue +455 -0
  100. package/ui-uni/uni-tag/uni-tag.vue +283 -0
  101. package/ui-uni/uni-tbody/uni-tbody.vue +30 -0
  102. package/ui-uni/uni-td/uni-td.vue +88 -0
  103. package/{ui-cv/cv-test/cv-test.vue → ui-uni/uni-test/uni-test.vue} +0 -0
  104. package/{ui-cv/cv-th → ui-uni/uni-th}/filter-dropdown.vue +0 -0
  105. package/ui-uni/uni-th/uni-th.vue +259 -0
  106. package/ui-uni/uni-thead/uni-thead.vue +114 -0
  107. package/ui-uni/uni-title/uni-title.vue +171 -0
  108. package/{ui-cv/cv-tr → ui-uni/uni-tr}/table-checkbox.vue +0 -0
  109. package/ui-uni/uni-tr/uni-tr.vue +156 -0
  110. package/{ui-cv/cv-transition → ui-uni/uni-transition}/createAnimation.js +0 -0
  111. package/ui-uni/uni-transition/uni-transition.vue +287 -0
  112. package/ui-cv/cv-badge/cv-badge.vue +0 -249
  113. package/ui-cv/cv-calendar/calendar.js +0 -963
  114. package/ui-cv/cv-calendar/cv-calendar-item.vue +0 -198
  115. package/ui-cv/cv-calendar/cv-calendar.vue +0 -508
  116. package/ui-cv/cv-card/cv-card.vue +0 -427
  117. package/ui-cv/cv-col/cv-col.vue +0 -2965
  118. package/ui-cv/cv-collapse/cv-collapse.vue +0 -146
  119. package/ui-cv/cv-collapse-item/cv-collapse-item.vue +0 -395
  120. package/ui-cv/cv-combox/cv-combox.vue +0 -250
  121. package/ui-cv/cv-countdown/cv-countdown.vue +0 -245
  122. package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +0 -841
  123. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +0 -154
  124. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +0 -376
  125. package/ui-cv/cv-data-picker/cv-data-picker.vue +0 -486
  126. package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +0 -304
  127. package/ui-cv/cv-dateformat/cv-dateformat.vue +0 -86
  128. package/ui-cv/cv-datetime-picker/calendar.vue +0 -761
  129. package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +0 -958
  130. package/ui-cv/cv-datetime-picker/time-picker.vue +0 -907
  131. package/ui-cv/cv-drawer/cv-drawer.vue +0 -185
  132. package/ui-cv/cv-drawer/keypress.js +0 -45
  133. package/ui-cv/cv-easyinput/cv-easyinput.vue +0 -514
  134. package/ui-cv/cv-fab/cv-fab.vue +0 -465
  135. package/ui-cv/cv-fav/cv-fav.vue +0 -150
  136. package/ui-cv/cv-file-picker/cv-file-picker.vue +0 -619
  137. package/ui-cv/cv-form-base/cv-form-base.vue +0 -470
  138. package/ui-cv/cv-form-base/validate.js +0 -477
  139. package/ui-cv/cv-grid-group/cv-grid-group.vue +0 -148
  140. package/ui-cv/cv-grid-item/cv-grid-item.vue +0 -132
  141. package/ui-cv/cv-icon2/cv-icon2.vue +0 -78
  142. package/ui-cv/cv-icon2/icons.js +0 -132
  143. package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +0 -154
  144. package/ui-cv/cv-indexed-list/cv-indexed-list.vue +0 -371
  145. package/ui-cv/cv-link2/cv-link2.vue +0 -130
  146. package/ui-cv/cv-list/cv-list.vue +0 -107
  147. package/ui-cv/cv-list/cv-refresh.vue +0 -65
  148. package/ui-cv/cv-list-ad/cv-list-ad.vue +0 -113
  149. package/ui-cv/cv-list-item/cv-list-item.vue +0 -449
  150. package/ui-cv/cv-nav-bar/cv-nav-bar.vue +0 -256
  151. package/ui-cv/cv-notice-bar/cv-notice-bar.vue +0 -453
  152. package/ui-cv/cv-number-box/cv-number-box.vue +0 -223
  153. package/ui-cv/cv-pagination/cv-pagination.vue +0 -397
  154. package/ui-cv/cv-popup/cv-popup.vue +0 -429
  155. package/ui-cv/cv-popup-message/cv-popup-message.vue +0 -143
  156. package/ui-cv/cv-row/cv-row.vue +0 -157
  157. package/ui-cv/cv-search-bar/cv-search-bar.vue +0 -280
  158. package/ui-cv/cv-steps/cv-steps.vue +0 -293
  159. package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +0 -255
  160. package/ui-cv/cv-table/cv-table.vue +0 -460
  161. package/ui-cv/cv-tag/cv-tag.vue +0 -276
  162. package/ui-cv/cv-tbody/cv-tbody.vue +0 -28
  163. package/ui-cv/cv-td/cv-td.vue +0 -93
  164. package/ui-cv/cv-th/cv-th.vue +0 -270
  165. package/ui-cv/cv-thead/cv-thead.vue +0 -114
  166. package/ui-cv/cv-title/cv-title.vue +0 -168
  167. package/ui-cv/cv-tr/cv-tr.vue +0 -166
  168. package/ui-cv/cv-transition/cv-transition.vue +0 -279
@@ -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: 'uniThead',
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,171 @@
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: "UniTitle",
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
+ };
54
+ },
55
+ computed: {
56
+ textAlign() {
57
+ let align = 'center';
58
+ switch (this.align) {
59
+ case 'left':
60
+ align = 'flex-start'
61
+ break;
62
+ case 'center':
63
+ align = 'center'
64
+ break;
65
+ case 'right':
66
+ align = 'flex-end'
67
+ break;
68
+ }
69
+ return align
70
+ }
71
+ },
72
+ watch: {
73
+ title(newVal) {
74
+ if (this.isOpenStat()) {
75
+ // 上报数据
76
+ if (uni.report) {
77
+ uni.report('title', this.title)
78
+ }
79
+ }
80
+ }
81
+ },
82
+ mounted() {
83
+ if (this.isOpenStat()) {
84
+ // 上报数据
85
+ if (uni.report) {
86
+ uni.report('title', this.title)
87
+ }
88
+ }
89
+ },
90
+ methods: {
91
+ isOpenStat() {
92
+ if (this.stat === '') {
93
+ this.isStat = false
94
+ }
95
+ let stat_type = (typeof(this.stat) === 'boolean' && this.stat) || (typeof(this.stat) === 'string' && this.stat !==
96
+ '')
97
+ if (this.type === "") {
98
+ this.isStat = true
99
+ if (this.stat.toString() === 'false') {
100
+ this.isStat = false
101
+ }
102
+ }
103
+
104
+ if (this.type !== '') {
105
+ this.isStat = true
106
+ if (stat_type) {
107
+ this.isStat = true
108
+ } else {
109
+ this.isStat = false
110
+ }
111
+ }
112
+ return this.isStat
113
+ }
114
+ }
115
+ }
116
+ </script>
117
+
118
+ <style scoped>
119
+ /* .uni-title {
120
+
121
+ } */
122
+ .uni-title__box {
123
+ /* #ifndef APP-NVUE */
124
+ display: flex;
125
+ /* #endif */
126
+ flex-direction: column;
127
+ align-items: flex-start;
128
+ justify-content: center;
129
+ padding: 8px 0;
130
+ flex: 1;
131
+ }
132
+
133
+ .uni-title__base {
134
+ font-size: 15px;
135
+ color: #333;
136
+ font-weight: 500;
137
+ }
138
+
139
+ .uni-h1 {
140
+ font-size: 20px;
141
+ color: #333;
142
+ font-weight: bold;
143
+ }
144
+
145
+ .uni-h2 {
146
+ font-size: 18px;
147
+ color: #333;
148
+ font-weight: bold;
149
+ }
150
+
151
+ .uni-h3 {
152
+ font-size: 16px;
153
+ color: #333;
154
+ font-weight: bold;
155
+ /* font-weight: 400; */
156
+ }
157
+
158
+ .uni-h4 {
159
+ font-size: 14px;
160
+ color: #333;
161
+ font-weight: bold;
162
+ /* font-weight: 300; */
163
+ }
164
+
165
+ .uni-h5 {
166
+ font-size: 12px;
167
+ color: #333;
168
+ font-weight: bold;
169
+ /* font-weight: 200; */
170
+ }
171
+ </style>
@@ -0,0 +1,156 @@
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 :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
6
+ </th>
7
+ <slot></slot>
8
+ <!-- <uni-th class="th-fixed">123</uni-th> -->
9
+ </tr>
10
+ <!-- #endif -->
11
+ <!-- #ifndef H5 -->
12
+ <view class="uni-table-tr">
13
+ <view v-if="selection === 'selection' " class="checkbox" :class="{ 'tr-table--border': border }">
14
+ <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
15
+ </view>
16
+ <slot></slot>
17
+ </view>
18
+ <!-- #endif -->
19
+ </template>
20
+
21
+ <script>
22
+ import tableCheckbox from './table-checkbox.vue'
23
+ /**
24
+ * Tr 表格行组件
25
+ * @description 表格行组件 仅包含 th,td 组件
26
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=
27
+ */
28
+ export default {
29
+ name: 'uniTr',
30
+ components: {
31
+ tableCheckbox
32
+ },
33
+ props: {
34
+ disabled: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ keyValue: {
39
+ type: [String, Number],
40
+ default: ''
41
+ }
42
+ },
43
+ options: {
44
+ virtualHost: true
45
+ },
46
+ data() {
47
+ return {
48
+ value: false,
49
+ border: false,
50
+ selection: false,
51
+ widthThArr: [],
52
+ ishead: true,
53
+ checked: false,
54
+ indeterminate: false
55
+ }
56
+ },
57
+ created() {
58
+ this.root = this.getTable()
59
+ this.head = this.getTable('uniThead')
60
+ if (this.head) {
61
+ this.ishead = false
62
+ this.head.init(this)
63
+ }
64
+ this.border = this.root.border
65
+ this.selection = this.root.type
66
+ this.root.trChildren.push(this)
67
+ const rowData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
68
+ if (rowData) {
69
+ this.rowData = rowData
70
+ }
71
+ this.root.isNodata()
72
+ },
73
+ mounted() {
74
+ if (this.widthThArr.length > 0) {
75
+ const selectionWidth = this.selection === 'selection' ? 50 : 0
76
+ this.root.minWidth = this.widthThArr.reduce((a, b) => Number(a) + Number(b)) + selectionWidth
77
+ }
78
+ },
79
+ // #ifndef VUE3
80
+ destroyed() {
81
+ const index = this.root.trChildren.findIndex(i => i === this)
82
+ this.root.trChildren.splice(index, 1)
83
+ this.root.isNodata()
84
+ },
85
+ // #endif
86
+ // #ifdef VUE3
87
+ unmounted() {
88
+ const index = this.root.trChildren.findIndex(i => i === this)
89
+ this.root.trChildren.splice(index, 1)
90
+ this.root.isNodata()
91
+ },
92
+ // #endif
93
+ methods: {
94
+ minWidthUpdate(width) {
95
+ this.widthThArr.push(width)
96
+ },
97
+ // 选中
98
+ checkboxSelected(e) {
99
+ let rootData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
100
+ this.checked = e.checked
101
+ this.root.check(rootData || this, e.checked, rootData ? this.keyValue : null)
102
+ },
103
+ change(e) {
104
+ this.root.trChildren.forEach(item => {
105
+ if (item === this) {
106
+ this.root.check(this, e.detail.value.length > 0 ? true : false)
107
+ }
108
+ })
109
+ },
110
+ /**
111
+ * 获取父元素实例
112
+ */
113
+ getTable(name = 'uniTable') {
114
+ let parent = this.$parent
115
+ let parentName = parent.$options.name
116
+ while (parentName !== name) {
117
+ parent = parent.$parent
118
+ if (!parent) return false
119
+ parentName = parent.$options.name
120
+ }
121
+ return parent
122
+ }
123
+ }
124
+ }
125
+ </script>
126
+
127
+ <style scoped>
128
+ .uni-table-tr {
129
+ /* #ifndef APP-NVUE */
130
+ display: table-row;
131
+ transition: all 0.3s;
132
+ box-sizing: border-box;
133
+ /* #endif */
134
+ }
135
+
136
+ .checkbox {
137
+ padding: 0 8px;
138
+ width: 26px;
139
+ padding-left: 12px;
140
+ /* #ifndef APP-NVUE */
141
+ display: table-cell;
142
+ vertical-align: middle;
143
+ /* #endif */
144
+ color: #333;
145
+ font-weight: 500;
146
+ border-bottom: 1px #ebeef5 solid;
147
+ font-size: 14px;
148
+ }
149
+
150
+ .tr-table--border {
151
+ border-right: 1px #ebeef5 solid;
152
+ }
153
+
154
+ /* #ifndef APP-NVUE */
155
+ /* #endif */
156
+ </style>