@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
@@ -147,7 +147,14 @@
147
147
  margin: $uni-card-spacing;
148
148
  border-radius: 4px;
149
149
  overflow: hidden;
150
- font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
150
+ font-family:
151
+ Helvetica Neue,
152
+ Helvetica,
153
+ PingFang SC,
154
+ Hiragino Sans GB,
155
+ Microsoft YaHei,
156
+ SimSun,
157
+ sans-serif;
151
158
  background-color: #fff;
152
159
  flex: 1;
153
160
 
@@ -1,317 +1,324 @@
1
1
  <template>
2
- <!-- #ifndef APP-NVUE -->
3
- <view :class="['uni-col', sizeClass, pointClassList]" :style="{
4
- paddingLeft:`${Number(gutter)}rpx`,
5
- paddingRight:`${Number(gutter)}rpx`,
6
- }">
7
- <slot></slot>
8
- </view>
9
- <!-- #endif -->
10
- <!-- #ifdef APP-NVUE -->
11
- <!-- 在nvue上,类名样式不生效,换为style -->
12
- <!-- 设置right正值失效,设置 left 负值 -->
13
- <view :class="['uni-col']" :style="{
14
- paddingLeft:`${Number(gutter)}rpx`,
15
- paddingRight:`${Number(gutter)}rpx`,
16
- width:`${nvueWidth}rpx`,
17
- position:'relative',
18
- marginLeft:`${marginLeft}rpx`,
19
- left:`${right === 0 ? left : -right}rpx`
20
- }">
21
- <slot></slot>
22
- </view>
23
- <!-- #endif -->
2
+ <!-- #ifndef APP-NVUE -->
3
+ <view
4
+ :class="['uni-col', sizeClass, pointClassList]"
5
+ :style="{
6
+ paddingLeft: `${Number(gutter)}rpx`,
7
+ paddingRight: `${Number(gutter)}rpx`,
8
+ }"
9
+ >
10
+ <slot></slot>
11
+ </view>
12
+ <!-- #endif -->
13
+ <!-- #ifdef APP-NVUE -->
14
+ <!-- 在nvue上,类名样式不生效,换为style -->
15
+ <!-- 设置right正值失效,设置 left 负值 -->
16
+ <view
17
+ :class="['uni-col']"
18
+ :style="{
19
+ paddingLeft: `${Number(gutter)}rpx`,
20
+ paddingRight: `${Number(gutter)}rpx`,
21
+ width: `${nvueWidth}rpx`,
22
+ position: 'relative',
23
+ marginLeft: `${marginLeft}rpx`,
24
+ left: `${right === 0 ? left : -right}rpx`,
25
+ }"
26
+ >
27
+ <slot></slot>
28
+ </view>
29
+ <!-- #endif -->
24
30
  </template>
25
31
 
26
32
  <script>
27
- /**
28
- * Col 布局-列
29
- * @description 搭配uni-row使用,构建布局。
30
- * @tutorial https://ext.dcloud.net.cn/plugin?id=3958
31
- *
32
- * @property {span} type = Number 栅格占据的列数
33
- * 默认 24
34
- * @property {offset} type = Number 栅格左侧的间隔格数
35
- * @property {push} type = Number 栅格向右移动格数
36
- * @property {pull} type = Number 栅格向左移动格数
37
- * @property {xs} type = [Number, Object] <768px 响应式栅格数或者栅格属性对象
38
- * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
39
- * @property {sm} type = [Number, Object] ≥768px 响应式栅格数或者栅格属性对象
40
- * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
41
- * @property {md} type = [Number, Object] ≥992px 响应式栅格数或者栅格属性对象
42
- * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
43
- * @property {lg} type = [Number, Object] ≥1200px 响应式栅格数或者栅格属性对象
44
- * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
45
- * @property {xl} type = [Number, Object] ≥1920px 响应式栅格数或者栅格属性对象
46
- * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
47
- */
48
- const ComponentClass = 'uni-col';
33
+ /**
34
+ * Col 布局-列
35
+ * @description 搭配uni-row使用,构建布局。
36
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=3958
37
+ *
38
+ * @property {span} type = Number 栅格占据的列数
39
+ * 默认 24
40
+ * @property {offset} type = Number 栅格左侧的间隔格数
41
+ * @property {push} type = Number 栅格向右移动格数
42
+ * @property {pull} type = Number 栅格向左移动格数
43
+ * @property {xs} type = [Number, Object] <768px 响应式栅格数或者栅格属性对象
44
+ * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
45
+ * @property {sm} type = [Number, Object] ≥768px 响应式栅格数或者栅格属性对象
46
+ * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
47
+ * @property {md} type = [Number, Object] ≥992px 响应式栅格数或者栅格属性对象
48
+ * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
49
+ * @property {lg} type = [Number, Object] ≥1200px 响应式栅格数或者栅格属性对象
50
+ * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
51
+ * @property {xl} type = [Number, Object] ≥1920px 响应式栅格数或者栅格属性对象
52
+ * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
53
+ */
54
+ const ComponentClass = 'uni-col';
49
55
 
50
- // -1 默认值,因为在微信小程序端只给Number会有默认值0
51
- export default {
52
- name: 'uniCol',
53
- // #ifdef MP-WEIXIN
54
- options: {
55
- virtualHost: true // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现
56
- },
57
- // #endif
58
- props: {
59
- span: {
60
- type: Number,
61
- default: 24
62
- },
63
- offset: {
64
- type: Number,
65
- default: -1
66
- },
67
- pull: {
68
- type: Number,
69
- default: -1
70
- },
71
- push: {
72
- type: Number,
73
- default: -1
74
- },
75
- xs: [Number, Object],
76
- sm: [Number, Object],
77
- md: [Number, Object],
78
- lg: [Number, Object],
79
- xl: [Number, Object]
80
- },
81
- data() {
82
- return {
83
- gutter: 0,
84
- sizeClass: '',
85
- parentWidth: 0,
86
- nvueWidth: 0,
87
- marginLeft: 0,
88
- right: 0,
89
- left: 0
90
- }
91
- },
92
- created() {
93
- // 字节小程序中,在computed中读取$parent为undefined
94
- let parent = this.$parent;
56
+ // -1 默认值,因为在微信小程序端只给Number会有默认值0
57
+ export default {
58
+ name: 'uniCol',
59
+ // #ifdef MP-WEIXIN
60
+ options: {
61
+ virtualHost: true, // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现
62
+ },
63
+ // #endif
64
+ props: {
65
+ span: {
66
+ type: Number,
67
+ default: 24,
68
+ },
69
+ offset: {
70
+ type: Number,
71
+ default: -1,
72
+ },
73
+ pull: {
74
+ type: Number,
75
+ default: -1,
76
+ },
77
+ push: {
78
+ type: Number,
79
+ default: -1,
80
+ },
81
+ xs: [Number, Object],
82
+ sm: [Number, Object],
83
+ md: [Number, Object],
84
+ lg: [Number, Object],
85
+ xl: [Number, Object],
86
+ },
87
+ data() {
88
+ return {
89
+ gutter: 0,
90
+ sizeClass: '',
91
+ parentWidth: 0,
92
+ nvueWidth: 0,
93
+ marginLeft: 0,
94
+ right: 0,
95
+ left: 0,
96
+ };
97
+ },
98
+ created() {
99
+ // 字节小程序中,在computed中读取$parent为undefined
100
+ let parent = this.$parent;
95
101
 
96
- while (parent && parent.$options.componentName !== 'UniRow') {
97
- parent = parent.$parent;
98
- }
102
+ while (parent && parent.$options.componentName !== 'UniRow') {
103
+ parent = parent.$parent;
104
+ }
99
105
 
100
- this.updateGutter(parent.gutter)
101
- parent.$watch('gutter', (gutter) => {
102
- this.updateGutter(gutter)
103
- })
106
+ this.updateGutter(parent.gutter);
107
+ parent.$watch('gutter', (gutter) => {
108
+ this.updateGutter(gutter);
109
+ });
104
110
 
105
- // #ifdef APP-NVUE
106
- this.updateNvueWidth(parent.width)
107
- parent.$watch('width', (width) => {
108
- this.updateNvueWidth(width)
109
- })
110
- // #endif
111
- },
112
- computed: {
113
- sizeList() {
114
- let {
115
- span,
116
- offset,
117
- pull,
118
- push
119
- } = this;
111
+ // #ifdef APP-NVUE
112
+ this.updateNvueWidth(parent.width);
113
+ parent.$watch('width', (width) => {
114
+ this.updateNvueWidth(width);
115
+ });
116
+ // #endif
117
+ },
118
+ computed: {
119
+ sizeList() {
120
+ let { span, offset, pull, push } = this;
120
121
 
121
- return {
122
- span,
123
- offset,
124
- pull,
125
- push
126
- }
127
- },
128
- // #ifndef APP-NVUE
129
- pointClassList() {
130
- let classList = [];
122
+ return {
123
+ span,
124
+ offset,
125
+ pull,
126
+ push,
127
+ };
128
+ },
129
+ // #ifndef APP-NVUE
130
+ pointClassList() {
131
+ let classList = [];
131
132
 
132
- ['xs', 'sm', 'md', 'lg', 'xl'].forEach(point => {
133
- const props = this[point];
134
- if (typeof props === 'number') {
135
- classList.push(`${ComponentClass}-${point}-${props}`)
136
- } else if (typeof props === 'object' && props) {
137
- Object.keys(props).forEach(pointProp => {
138
- classList.push(
139
- pointProp === 'span' ?
140
- `${ComponentClass}-${point}-${props[pointProp]}` :
141
- `${ComponentClass}-${point}-${pointProp}-${props[pointProp]}`
142
- )
143
- })
144
- }
145
- });
133
+ ['xs', 'sm', 'md', 'lg', 'xl'].forEach((point) => {
134
+ const props = this[point];
135
+ if (typeof props === 'number') {
136
+ classList.push(`${ComponentClass}-${point}-${props}`);
137
+ } else if (typeof props === 'object' && props) {
138
+ Object.keys(props).forEach((pointProp) => {
139
+ classList.push(
140
+ pointProp === 'span'
141
+ ? `${ComponentClass}-${point}-${props[pointProp]}`
142
+ : `${ComponentClass}-${point}-${pointProp}-${props[pointProp]}`,
143
+ );
144
+ });
145
+ }
146
+ });
146
147
 
147
- // 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
148
- return classList.join(' ');
149
- }
150
- // #endif
151
- },
152
- methods: {
153
- updateGutter(parentGutter) {
154
- parentGutter = Number(parentGutter);
155
- if (!isNaN(parentGutter)) {
156
- this.gutter = parentGutter / 2
157
- }
158
- },
159
- // #ifdef APP-NVUE
160
- updateNvueWidth(width) {
161
- // 用于在nvue端,span,offset,pull,push的计算
162
- this.parentWidth = width;
163
- ['span', 'offset', 'pull', 'push'].forEach(size => {
164
- const curSize = this[size];
165
- if ((curSize || curSize === 0) && curSize !== -1) {
166
- let RPX = 1 / 24 * curSize * width
167
- RPX = Number(RPX);
168
- switch (size) {
169
- case 'span':
170
- this.nvueWidth = RPX
171
- break;
172
- case 'offset':
173
- this.marginLeft = RPX
174
- break;
175
- case 'pull':
176
- this.right = RPX
177
- break;
178
- case 'push':
179
- this.left = RPX
180
- break;
181
- }
182
- }
183
- });
184
- }
185
- // #endif
186
- },
187
- watch: {
188
- sizeList: {
189
- immediate: true,
190
- handler(newVal) {
191
- // #ifndef APP-NVUE
192
- let classList = [];
193
- for (let size in newVal) {
194
- const curSize = newVal[size];
195
- if ((curSize || curSize === 0) && curSize !== -1) {
196
- classList.push(
197
- size === 'span' ?
198
- `${ComponentClass}-${curSize}` :
199
- `${ComponentClass}-${size}-${curSize}`
200
- )
201
- }
202
- }
203
- // 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
204
- this.sizeClass = classList.join(' ');
205
- // #endif
206
- // #ifdef APP-NVUE
207
- this.updateNvueWidth(this.parentWidth);
208
- // #endif
209
- }
210
- }
211
- }
212
- }
148
+ // 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
149
+ return classList.join(' ');
150
+ },
151
+ // #endif
152
+ },
153
+ methods: {
154
+ updateGutter(parentGutter) {
155
+ parentGutter = Number(parentGutter);
156
+ if (!isNaN(parentGutter)) {
157
+ this.gutter = parentGutter / 2;
158
+ }
159
+ },
160
+ // #ifdef APP-NVUE
161
+ updateNvueWidth(width) {
162
+ // 用于在nvue端,span,offset,pull,push的计算
163
+ this.parentWidth = width;
164
+ ['span', 'offset', 'pull', 'push'].forEach((size) => {
165
+ const curSize = this[size];
166
+ if ((curSize || curSize === 0) && curSize !== -1) {
167
+ let RPX = (1 / 24) * curSize * width;
168
+ RPX = Number(RPX);
169
+ switch (size) {
170
+ case 'span':
171
+ this.nvueWidth = RPX;
172
+ break;
173
+ case 'offset':
174
+ this.marginLeft = RPX;
175
+ break;
176
+ case 'pull':
177
+ this.right = RPX;
178
+ break;
179
+ case 'push':
180
+ this.left = RPX;
181
+ break;
182
+ }
183
+ }
184
+ });
185
+ },
186
+ // #endif
187
+ },
188
+ watch: {
189
+ sizeList: {
190
+ immediate: true,
191
+ handler(newVal) {
192
+ // #ifndef APP-NVUE
193
+ let classList = [];
194
+ for (let size in newVal) {
195
+ const curSize = newVal[size];
196
+ if ((curSize || curSize === 0) && curSize !== -1) {
197
+ classList.push(size === 'span' ? `${ComponentClass}-${curSize}` : `${ComponentClass}-${size}-${curSize}`);
198
+ }
199
+ }
200
+ // 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
201
+ this.sizeClass = classList.join(' ');
202
+ // #endif
203
+ // #ifdef APP-NVUE
204
+ this.updateNvueWidth(this.parentWidth);
205
+ // #endif
206
+ },
207
+ },
208
+ },
209
+ };
213
210
  </script>
214
211
 
215
- <style lang='scss' >
216
- /* breakpoints */
217
- $--sm: 768px !default;
218
- $--md: 992px !default;
219
- $--lg: 1200px !default;
220
- $--xl: 1920px !default;
212
+ <style lang="scss">
213
+ /* breakpoints */
214
+ $--sm: 768px !default;
215
+ $--md: 992px !default;
216
+ $--lg: 1200px !default;
217
+ $--xl: 1920px !default;
221
218
 
222
- $breakpoints: ('xs' : (max-width: $--sm - 1),
223
- 'sm' : (min-width: $--sm),
224
- 'md' : (min-width: $--md),
225
- 'lg' : (min-width: $--lg),
226
- 'xl' : (min-width: $--xl));
219
+ $breakpoints: (
220
+ 'xs': (
221
+ max-width: $--sm - 1,
222
+ ),
223
+ 'sm': (
224
+ min-width: $--sm,
225
+ ),
226
+ 'md': (
227
+ min-width: $--md,
228
+ ),
229
+ 'lg': (
230
+ min-width: $--lg,
231
+ ),
232
+ 'xl': (
233
+ min-width: $--xl,
234
+ ),
235
+ );
227
236
 
228
- $layout-namespace: ".uni-";
229
- $col: $layout-namespace+"col";
237
+ $layout-namespace: '.uni-';
238
+ $col: $layout-namespace + 'col';
230
239
 
231
- @function getSize($size) {
232
- /* TODO 1/24 * $size * 100 * 1%; 使用计算后的值,为了解决 vue3 控制台报错 */
233
- @return 0.04166666666 * $size * 100 * 1%;
234
- }
240
+ @function getSize($size) {
241
+ /* TODO 1/24 * $size * 100 * 1%; 使用计算后的值,为了解决 vue3 控制台报错 */
242
+ @return 0.04166666666 * $size * 100 * 1%;
243
+ }
235
244
 
236
- @mixin res($key, $map:$breakpoints) {
237
- @if map-has-key($map, $key) {
238
- @media screen and #{inspect(map-get($map,$key))} {
239
- @content;
240
- }
241
- }
245
+ @mixin res($key, $map: $breakpoints) {
246
+ @if map-has-key($map, $key) {
247
+ @media screen and #{inspect(map-get($map,$key))} {
248
+ @content;
249
+ }
250
+ } @else {
251
+ @warn "Undeinfed point: `#{$key}`";
252
+ }
253
+ }
242
254
 
243
- @else {
244
- @warn "Undeinfed point: `#{$key}`";
245
- }
246
- }
255
+ /* #ifndef APP-NVUE */
256
+ #{$col} {
257
+ float: left;
258
+ box-sizing: border-box;
259
+ }
247
260
 
248
- /* #ifndef APP-NVUE */
249
- #{$col} {
250
- float: left;
251
- box-sizing: border-box;
252
- }
261
+ #{$col}-0 {
262
+ /* #ifdef APP-NVUE */
263
+ width: 0;
264
+ height: 0;
265
+ margin-top: 0;
266
+ margin-right: 0;
267
+ margin-bottom: 0;
268
+ margin-left: 0;
269
+ /* #endif */
270
+ /* #ifndef APP-NVUE */
271
+ display: none;
272
+ /* #endif */
273
+ }
253
274
 
254
- #{$col}-0 {
255
- /* #ifdef APP-NVUE */
256
- width: 0;
257
- height: 0;
258
- margin-top: 0;
259
- margin-right: 0;
260
- margin-bottom: 0;
261
- margin-left: 0;
262
- /* #endif */
263
- /* #ifndef APP-NVUE */
264
- display: none;
265
- /* #endif */
266
- }
275
+ @for $i from 0 through 24 {
276
+ #{$col}-#{$i} {
277
+ width: getSize($i);
278
+ }
267
279
 
268
- @for $i from 0 through 24 {
269
- #{$col}-#{$i} {
270
- width: getSize($i);
271
- }
280
+ #{$col}-offset-#{$i} {
281
+ margin-left: getSize($i);
282
+ }
272
283
 
273
- #{$col}-offset-#{$i} {
274
- margin-left: getSize($i);
275
- }
284
+ #{$col}-pull-#{$i} {
285
+ position: relative;
286
+ right: getSize($i);
287
+ }
276
288
 
277
- #{$col}-pull-#{$i} {
278
- position: relative;
279
- right: getSize($i);
280
- }
289
+ #{$col}-push-#{$i} {
290
+ position: relative;
291
+ left: getSize($i);
292
+ }
293
+ }
281
294
 
282
- #{$col}-push-#{$i} {
283
- position: relative;
284
- left: getSize($i);
285
- }
286
- }
295
+ @each $point in map-keys($breakpoints) {
296
+ @include res($point) {
297
+ #{$col}-#{$point}-0 {
298
+ display: none;
299
+ }
287
300
 
288
- @each $point in map-keys($breakpoints) {
289
- @include res($point) {
290
- #{$col}-#{$point}-0 {
291
- display: none;
292
- }
301
+ @for $i from 0 through 24 {
302
+ #{$col}-#{$point}-#{$i} {
303
+ width: getSize($i);
304
+ }
293
305
 
294
- @for $i from 0 through 24 {
295
- #{$col}-#{$point}-#{$i} {
296
- width: getSize($i);
297
- }
306
+ #{$col}-#{$point}-offset-#{$i} {
307
+ margin-left: getSize($i);
308
+ }
298
309
 
299
- #{$col}-#{$point}-offset-#{$i} {
300
- margin-left: getSize($i);
301
- }
310
+ #{$col}-#{$point}-pull-#{$i} {
311
+ position: relative;
312
+ right: getSize($i);
313
+ }
302
314
 
303
- #{$col}-#{$point}-pull-#{$i} {
304
- position: relative;
305
- right: getSize($i);
306
- }
315
+ #{$col}-#{$point}-push-#{$i} {
316
+ position: relative;
317
+ left: getSize($i);
318
+ }
319
+ }
320
+ }
321
+ }
307
322
 
308
- #{$col}-#{$point}-push-#{$i} {
309
- position: relative;
310
- left: getSize($i);
311
- }
312
- }
313
- }
314
- }
315
-
316
- /* #endif */
323
+ /* #endif */
317
324
  </style>