@kengic/uni 0.5.1 → 0.5.2-beta.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.
Files changed (146) hide show
  1. package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
  2. package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
  3. package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
  4. package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
  5. package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
  6. package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
  7. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
  8. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
  9. package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
  10. package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
  11. package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
  12. package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
  13. package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
  14. package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
  15. package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
  16. package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
  17. package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
  18. package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
  19. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
  20. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
  21. package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
  22. package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
  23. package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
  24. package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
  25. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
  26. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
  27. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
  28. package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
  29. package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
  30. package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
  31. package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
  32. package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
  33. package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
  34. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
  35. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
  36. package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
  37. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
  38. package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
  39. package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
  40. package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
  41. package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
  42. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
  43. package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
  44. package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
  45. package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
  46. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
  47. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
  48. package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
  49. package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
  50. package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
  51. package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
  52. package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
  53. package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
  54. package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
  55. package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
  56. package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
  57. package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
  58. package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
  59. package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
  60. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
  61. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
  62. package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
  63. package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
  64. package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
  65. package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
  66. package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
  67. package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
  68. package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
  69. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
  70. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
  71. package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
  72. package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
  73. package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
  74. package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
  75. package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
  76. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
  77. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
  78. package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
  79. package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
  80. package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
  81. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
  82. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
  83. package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
  84. package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
  85. package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
  86. package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
  87. package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
  88. package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
  89. package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
  90. package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
  91. package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
  92. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
  93. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
  94. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
  95. package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
  96. package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
  97. package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
  98. package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
  99. package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
  100. package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
  101. package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
  102. package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
  103. package/dist/uni/uni-ui/uni-scss/package.json +73 -73
  104. package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
  105. package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
  106. package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
  107. package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
  108. package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
  109. package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
  110. package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
  111. package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
  112. package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
  113. package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
  114. package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
  115. package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
  116. package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
  117. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
  118. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
  119. package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
  120. package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
  121. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
  122. package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
  123. package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
  124. package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
  125. package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
  126. package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
  127. package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
  128. package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
  129. package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
  130. package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
  131. package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
  132. package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
  133. package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
  134. package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
  135. package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
  136. package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
  137. package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
  138. package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
  139. package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
  140. package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
  141. package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
  142. package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
  143. package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
  144. package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
  145. package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
  146. package/package.json +1 -1
@@ -1,285 +1,301 @@
1
1
  <template>
2
- <!-- #ifdef H5 -->
3
- <th :rowspan="rowspan" :colspan="colspan" class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }">
4
- <view class="uni-table-th-row">
5
- <view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort">
6
- <slot></slot>
7
- <view v-if="sortable" class="arrow-box">
8
- <text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text>
9
- <text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text>
10
- </view>
11
- </view>
12
- <dropdown v-if="filterType || filterData.length" :filterDefaultValue="filterDefaultValue" :filterData="filterData" :filterType="filterType" @change="ondropdown"></dropdown>
13
- </view>
14
- </th>
15
- <!-- #endif -->
16
- <!-- #ifndef H5 -->
17
- <view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"><slot></slot></view>
18
- <!-- #endif -->
2
+ <!-- #ifdef H5 -->
3
+ <th
4
+ :rowspan="rowspan"
5
+ :colspan="colspan"
6
+ class="uni-table-th"
7
+ :class="{ 'table--border': border }"
8
+ :style="{ width: customWidth + 'px', 'text-align': align }"
9
+ >
10
+ <view class="uni-table-th-row">
11
+ <view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort">
12
+ <slot></slot>
13
+ <view v-if="sortable" class="arrow-box">
14
+ <text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text>
15
+ <text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text>
16
+ </view>
17
+ </view>
18
+ <dropdown
19
+ v-if="filterType || filterData.length"
20
+ :filterDefaultValue="filterDefaultValue"
21
+ :filterData="filterData"
22
+ :filterType="filterType"
23
+ @change="ondropdown"
24
+ ></dropdown>
25
+ </view>
26
+ </th>
27
+ <!-- #endif -->
28
+ <!-- #ifndef H5 -->
29
+ <view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"><slot></slot></view>
30
+ <!-- #endif -->
19
31
  </template>
20
32
 
21
33
  <script>
22
- // #ifdef H5
23
- import dropdown from './filter-dropdown.vue'
24
- // #endif
25
- /**
26
- * Th 表头
27
- * @description 表格内的表头单元格组件
28
- * @tutorial https://ext.dcloud.net.cn/plugin?id=3270
29
- * @property {Number | String} width 单元格宽度(支持纯数字、携带单位px或rpx)
30
- * @property {Boolean} sortable 是否启用排序
31
- * @property {Number} align = [left|center|right] 单元格对齐方式
32
- * @value left 单元格文字左侧对齐
33
- * @value center 单元格文字居中
34
- * @value right 单元格文字右侧对齐
35
- * @property {Array} filterData 筛选数据
36
- * @property {String} filterType [search|select] 筛选类型
37
- * @value search 关键字搜素
38
- * @value select 条件选择
39
- * @event {Function} sort-change 排序触发事件
40
- */
41
- export default {
42
- name: 'uniTh',
43
- options: {
44
- virtualHost: true
45
- },
46
- components: {
47
- // #ifdef H5
48
- dropdown
49
- // #endif
50
- },
51
- emits:['sort-change','filter-change'],
52
- props: {
53
- width: {
54
- type: [String, Number],
55
- default: ''
56
- },
57
- align: {
58
- type: String,
59
- default: 'left'
60
- },
61
- rowspan: {
62
- type: [Number, String],
63
- default: 1
64
- },
65
- colspan: {
66
- type: [Number, String],
67
- default: 1
68
- },
69
- sortable: {
70
- type: Boolean,
71
- default: false
72
- },
73
- filterType: {
74
- type: String,
75
- default: ""
76
- },
77
- filterData: {
78
- type: Array,
79
- default () {
80
- return []
81
- }
82
- },
83
- filterDefaultValue: {
84
- type: [Array,String],
85
- default () {
86
- return ""
87
- }
88
- }
89
- },
90
- data() {
91
- return {
92
- border: false,
93
- ascending: false,
94
- descending: false
95
- }
96
- },
97
- computed: {
98
- // 根据props中的width属性 自动匹配当前th的宽度(px)
99
- customWidth(){
100
- if(typeof this.width === 'number'){
101
- return this.width
102
- } else if(typeof this.width === 'string') {
103
- let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g)
104
- let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g)
105
- let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g)
106
- if (this.width.match(regexHaveUnitPx) !== null) { // 携带了 px
107
- return this.width.replace('px', '')
108
- } else if (this.width.match(regexHaveUnitRpx) !== null) { // 携带了 rpx
109
- let numberRpx = Number(this.width.replace('rpx', ''))
110
- let widthCoe = uni.getSystemInfoSync().screenWidth / 750
111
- return Math.round(numberRpx * widthCoe)
112
- } else if (this.width.match(regexHaveNotUnit) !== null) { // 未携带 rpx或px 的纯数字 String
113
- return this.width
114
- } else { // 不符合格式
115
- return ''
116
- }
117
- } else {
118
- return ''
119
- }
120
- },
121
- contentAlign() {
122
- let align = 'left'
123
- switch (this.align) {
124
- case 'left':
125
- align = 'flex-start'
126
- break
127
- case 'center':
128
- align = 'center'
129
- break
130
- case 'right':
131
- align = 'flex-end'
132
- break
133
- }
134
- return align
135
- }
136
- },
137
- created() {
138
- this.root = this.getTable('uniTable')
139
- this.rootTr = this.getTable('uniTr')
140
- this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140)
141
- this.border = this.root.border
142
- this.root.thChildren.push(this)
143
- },
144
- methods: {
145
- sort() {
146
- if (!this.sortable) return
147
- this.clearOther()
148
- if (!this.ascending && !this.descending) {
149
- this.ascending = true
150
- this.$emit('sort-change', { order: 'ascending' })
151
- return
152
- }
153
- if (this.ascending && !this.descending) {
154
- this.ascending = false
155
- this.descending = true
156
- this.$emit('sort-change', { order: 'descending' })
157
- return
158
- }
34
+ // #ifdef H5
35
+ import dropdown from './filter-dropdown.vue';
36
+ // #endif
37
+ /**
38
+ * Th 表头
39
+ * @description 表格内的表头单元格组件
40
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=3270
41
+ * @property {Number | String} width 单元格宽度(支持纯数字、携带单位px或rpx)
42
+ * @property {Boolean} sortable 是否启用排序
43
+ * @property {Number} align = [left|center|right] 单元格对齐方式
44
+ * @value left 单元格文字左侧对齐
45
+ * @value center 单元格文字居中
46
+ * @value right 单元格文字右侧对齐
47
+ * @property {Array} filterData 筛选数据
48
+ * @property {String} filterType [search|select] 筛选类型
49
+ * @value search 关键字搜素
50
+ * @value select 条件选择
51
+ * @event {Function} sort-change 排序触发事件
52
+ */
53
+ export default {
54
+ name: 'uniTh',
55
+ options: {
56
+ virtualHost: true,
57
+ },
58
+ components: {
59
+ // #ifdef H5
60
+ dropdown,
61
+ // #endif
62
+ },
63
+ emits: ['sort-change', 'filter-change'],
64
+ props: {
65
+ width: {
66
+ type: [String, Number],
67
+ default: '',
68
+ },
69
+ align: {
70
+ type: String,
71
+ default: 'left',
72
+ },
73
+ rowspan: {
74
+ type: [Number, String],
75
+ default: 1,
76
+ },
77
+ colspan: {
78
+ type: [Number, String],
79
+ default: 1,
80
+ },
81
+ sortable: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
85
+ filterType: {
86
+ type: String,
87
+ default: '',
88
+ },
89
+ filterData: {
90
+ type: Array,
91
+ default() {
92
+ return [];
93
+ },
94
+ },
95
+ filterDefaultValue: {
96
+ type: [Array, String],
97
+ default() {
98
+ return '';
99
+ },
100
+ },
101
+ },
102
+ data() {
103
+ return {
104
+ border: false,
105
+ ascending: false,
106
+ descending: false,
107
+ };
108
+ },
109
+ computed: {
110
+ // 根据props中的width属性 自动匹配当前th的宽度(px)
111
+ customWidth() {
112
+ if (typeof this.width === 'number') {
113
+ return this.width;
114
+ } else if (typeof this.width === 'string') {
115
+ let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g);
116
+ let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g);
117
+ let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g);
118
+ if (this.width.match(regexHaveUnitPx) !== null) {
119
+ // 携带了 px
120
+ return this.width.replace('px', '');
121
+ } else if (this.width.match(regexHaveUnitRpx) !== null) {
122
+ // 携带了 rpx
123
+ let numberRpx = Number(this.width.replace('rpx', ''));
124
+ let widthCoe = uni.getSystemInfoSync().screenWidth / 750;
125
+ return Math.round(numberRpx * widthCoe);
126
+ } else if (this.width.match(regexHaveNotUnit) !== null) {
127
+ // 未携带 rpx或px 的纯数字 String
128
+ return this.width;
129
+ } else {
130
+ // 不符合格式
131
+ return '';
132
+ }
133
+ } else {
134
+ return '';
135
+ }
136
+ },
137
+ contentAlign() {
138
+ let align = 'left';
139
+ switch (this.align) {
140
+ case 'left':
141
+ align = 'flex-start';
142
+ break;
143
+ case 'center':
144
+ align = 'center';
145
+ break;
146
+ case 'right':
147
+ align = 'flex-end';
148
+ break;
149
+ }
150
+ return align;
151
+ },
152
+ },
153
+ created() {
154
+ this.root = this.getTable('uniTable');
155
+ this.rootTr = this.getTable('uniTr');
156
+ this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140);
157
+ this.border = this.root.border;
158
+ this.root.thChildren.push(this);
159
+ },
160
+ methods: {
161
+ sort() {
162
+ if (!this.sortable) return;
163
+ this.clearOther();
164
+ if (!this.ascending && !this.descending) {
165
+ this.ascending = true;
166
+ this.$emit('sort-change', { order: 'ascending' });
167
+ return;
168
+ }
169
+ if (this.ascending && !this.descending) {
170
+ this.ascending = false;
171
+ this.descending = true;
172
+ this.$emit('sort-change', { order: 'descending' });
173
+ return;
174
+ }
159
175
 
160
- if (!this.ascending && this.descending) {
161
- this.ascending = false
162
- this.descending = false
163
- this.$emit('sort-change', { order: null })
164
- }
165
- },
166
- ascendingFn() {
167
- this.clearOther()
168
- this.ascending = !this.ascending
169
- this.descending = false
170
- this.$emit('sort-change', { order: this.ascending ? 'ascending' : null })
171
- },
172
- descendingFn() {
173
- this.clearOther()
174
- this.descending = !this.descending
175
- this.ascending = false
176
- this.$emit('sort-change', { order: this.descending ? 'descending' : null })
177
- },
178
- clearOther() {
179
- this.root.thChildren.map(item => {
180
- if (item !== this) {
181
- item.ascending = false
182
- item.descending = false
183
- }
184
- return item
185
- })
186
- },
187
- ondropdown(e) {
188
- this.$emit("filter-change", e)
189
- },
190
- /**
191
- * 获取父元素实例
192
- */
193
- getTable(name) {
194
- let parent = this.$parent
195
- let parentName = parent.$options.name
196
- while (parentName !== name) {
197
- parent = parent.$parent
198
- if (!parent) return false
199
- parentName = parent.$options.name
200
- }
201
- return parent
202
- }
203
- }
204
- }
176
+ if (!this.ascending && this.descending) {
177
+ this.ascending = false;
178
+ this.descending = false;
179
+ this.$emit('sort-change', { order: null });
180
+ }
181
+ },
182
+ ascendingFn() {
183
+ this.clearOther();
184
+ this.ascending = !this.ascending;
185
+ this.descending = false;
186
+ this.$emit('sort-change', { order: this.ascending ? 'ascending' : null });
187
+ },
188
+ descendingFn() {
189
+ this.clearOther();
190
+ this.descending = !this.descending;
191
+ this.ascending = false;
192
+ this.$emit('sort-change', { order: this.descending ? 'descending' : null });
193
+ },
194
+ clearOther() {
195
+ this.root.thChildren.map((item) => {
196
+ if (item !== this) {
197
+ item.ascending = false;
198
+ item.descending = false;
199
+ }
200
+ return item;
201
+ });
202
+ },
203
+ ondropdown(e) {
204
+ this.$emit('filter-change', e);
205
+ },
206
+ /**
207
+ * 获取父元素实例
208
+ */
209
+ getTable(name) {
210
+ let parent = this.$parent;
211
+ let parentName = parent.$options.name;
212
+ while (parentName !== name) {
213
+ parent = parent.$parent;
214
+ if (!parent) return false;
215
+ parentName = parent.$options.name;
216
+ }
217
+ return parent;
218
+ },
219
+ },
220
+ };
205
221
  </script>
206
222
 
207
223
  <style lang="scss">
208
- $border-color: #ebeef5;
209
- $uni-primary: #007aff !default;
224
+ $border-color: #ebeef5;
225
+ $uni-primary: #007aff !default;
210
226
 
211
- .uni-table-th {
212
- padding: 12px 10px;
213
- /* #ifndef APP-NVUE */
214
- display: table-cell;
215
- box-sizing: border-box;
216
- /* #endif */
217
- font-size: 14px;
218
- font-weight: bold;
219
- color: #909399;
220
- border-bottom: 1px $border-color solid;
221
- }
227
+ .uni-table-th {
228
+ padding: 12px 10px;
229
+ /* #ifndef APP-NVUE */
230
+ display: table-cell;
231
+ box-sizing: border-box;
232
+ /* #endif */
233
+ font-size: 14px;
234
+ font-weight: bold;
235
+ color: #909399;
236
+ border-bottom: 1px $border-color solid;
237
+ }
222
238
 
223
- .uni-table-th-row {
224
- /* #ifndef APP-NVUE */
225
- display: flex;
226
- /* #endif */
227
- flex-direction: row;
228
- }
239
+ .uni-table-th-row {
240
+ /* #ifndef APP-NVUE */
241
+ display: flex;
242
+ /* #endif */
243
+ flex-direction: row;
244
+ }
229
245
 
230
- .table--border {
231
- border-right: 1px $border-color solid;
232
- }
233
- .uni-table-th-content {
234
- display: flex;
235
- align-items: center;
236
- flex: 1;
237
- }
238
- .arrow-box {
239
- }
240
- .arrow {
241
- display: block;
242
- position: relative;
243
- width: 10px;
244
- height: 8px;
245
- // border: 1px red solid;
246
- left: 5px;
247
- overflow: hidden;
248
- cursor: pointer;
249
- }
250
- .down {
251
- top: 3px;
252
- ::after {
253
- content: '';
254
- width: 8px;
255
- height: 8px;
256
- position: absolute;
257
- left: 2px;
258
- top: -5px;
259
- transform: rotate(45deg);
260
- background-color: #ccc;
261
- }
262
- &.active {
263
- ::after {
264
- background-color: $uni-primary;
265
- }
266
- }
267
- }
268
- .up {
269
- ::after {
270
- content: '';
271
- width: 8px;
272
- height: 8px;
273
- position: absolute;
274
- left: 2px;
275
- top: 5px;
276
- transform: rotate(45deg);
277
- background-color: #ccc;
278
- }
279
- &.active {
280
- ::after {
281
- background-color: $uni-primary;
282
- }
283
- }
284
- }
246
+ .table--border {
247
+ border-right: 1px $border-color solid;
248
+ }
249
+ .uni-table-th-content {
250
+ display: flex;
251
+ align-items: center;
252
+ flex: 1;
253
+ }
254
+ .arrow-box {
255
+ }
256
+ .arrow {
257
+ display: block;
258
+ position: relative;
259
+ width: 10px;
260
+ height: 8px;
261
+ // border: 1px red solid;
262
+ left: 5px;
263
+ overflow: hidden;
264
+ cursor: pointer;
265
+ }
266
+ .down {
267
+ top: 3px;
268
+ ::after {
269
+ content: '';
270
+ width: 8px;
271
+ height: 8px;
272
+ position: absolute;
273
+ left: 2px;
274
+ top: -5px;
275
+ transform: rotate(45deg);
276
+ background-color: #ccc;
277
+ }
278
+ &.active {
279
+ ::after {
280
+ background-color: $uni-primary;
281
+ }
282
+ }
283
+ }
284
+ .up {
285
+ ::after {
286
+ content: '';
287
+ width: 8px;
288
+ height: 8px;
289
+ position: absolute;
290
+ left: 2px;
291
+ top: 5px;
292
+ transform: rotate(45deg);
293
+ background-color: #ccc;
294
+ }
295
+ &.active {
296
+ ::after {
297
+ background-color: $uni-primary;
298
+ }
299
+ }
300
+ }
285
301
  </style>