@kengic/uni 0.3.2-beta.10

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 (166) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/kengic-uni.js +5 -0
  4. package/dist/src/consts/i18n/en.d.ts +45 -0
  5. package/dist/src/consts/i18n/index.d.ts +90 -0
  6. package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
  7. package/dist/src/consts/index.d.ts +1 -0
  8. package/dist/src/index.d.ts +2 -0
  9. package/dist/src/utils/index.d.ts +1 -0
  10. package/dist/src/utils/kg.util.d.ts +5 -0
  11. package/dist/uni-ui/index.ts +11 -0
  12. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  13. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  14. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  15. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  16. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  17. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  18. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  19. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  20. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  21. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  22. package/dist/uni-ui/uni-calendar/util.js +360 -0
  23. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  24. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  25. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  26. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  27. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  28. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  29. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  30. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  31. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  32. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  33. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  34. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  35. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  36. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  37. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  38. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  39. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  40. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  41. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  42. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  43. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  44. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  45. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  46. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  47. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  48. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  49. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  50. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  51. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  52. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  53. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  54. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  55. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  56. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  57. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  58. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  59. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  60. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  61. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  62. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  63. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  64. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  65. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  66. package/dist/uni-ui/uni-forms/utils.js +293 -0
  67. package/dist/uni-ui/uni-forms/validate.js +486 -0
  68. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  69. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  70. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  71. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  72. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  73. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  74. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  75. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  76. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  77. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  78. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  79. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  80. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  81. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  82. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  83. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  84. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  85. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  86. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  87. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  88. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  89. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  90. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  91. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  92. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  93. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  94. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  95. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  96. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  97. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  98. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  99. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  100. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  101. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  102. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  103. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  104. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  105. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  106. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  107. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  108. package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
  109. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  110. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  111. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  112. package/dist/uni-ui/uni-popup/popup.js +23 -0
  113. package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
  114. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  115. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  116. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  117. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  118. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  119. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  120. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  121. package/dist/uni-ui/uni-scss/index.scss +1 -0
  122. package/dist/uni-ui/uni-scss/package.json +82 -0
  123. package/dist/uni-ui/uni-scss/readme.md +4 -0
  124. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  125. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  126. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  127. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  128. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  129. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  130. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  131. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  132. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  133. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  134. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  135. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  136. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  137. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  138. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  139. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  140. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  141. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  142. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  143. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  144. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  145. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  146. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  147. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  148. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  149. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  150. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  151. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  152. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  153. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  154. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  155. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  156. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  157. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  158. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  159. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  160. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  161. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  162. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  163. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  164. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  165. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  166. package/package.json +90 -0
@@ -0,0 +1,365 @@
1
+ <template>
2
+ <view>
3
+ <view ref="uni-rate" class="uni-rate">
4
+ <view class="uni-rate__icon" :class="{'uni-cursor-not-allowed': disabled}"
5
+ :style="{ 'margin-right': marginNumber + 'px' }" v-for="(star, index) in stars" :key="index"
6
+ @touchstart.stop="touchstart" @touchmove.stop="touchmove" @mousedown.stop="mousedown"
7
+ @mousemove.stop="mousemove" @mouseleave="mouseleave">
8
+ <uni-icons :color="color" :size="size" :type="isFill ? 'star-filled' : 'star'" />
9
+ <!-- #ifdef APP-NVUE -->
10
+ <view :style="{ width: star.activeWitch.replace('%','')*size/100+'px'}" class="uni-rate__icon-on">
11
+ <uni-icons style="text-align: left;" :color="disabled?'#ccc':activeColor" :size="size"
12
+ type="star-filled" />
13
+ </view>
14
+ <!-- #endif -->
15
+ <!-- #ifndef APP-NVUE -->
16
+ <view :style="{ width: star.activeWitch}" class="uni-rate__icon-on">
17
+ <uni-icons :color="disabled?disabledColor:activeColor" :size="size" type="star-filled" />
18
+ </view>
19
+ <!-- #endif -->
20
+ </view>
21
+ </view>
22
+ </view>
23
+ </template>
24
+
25
+ <script>
26
+ // #ifdef APP-NVUE
27
+ const dom = uni.requireNativePlugin('dom');
28
+ // #endif
29
+ /**
30
+ * Rate 评分
31
+ * @description 评分组件
32
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=33
33
+ * @property {Boolean} isFill = [true|false] 星星的类型,是否为实心类型, 默认为实心
34
+ * @property {String} color 未选中状态的星星颜色,默认为 "#ececec"
35
+ * @property {String} activeColor 选中状态的星星颜色,默认为 "#ffca3e"
36
+ * @property {String} disabledColor 禁用状态的星星颜色,默认为 "#c0c0c0"
37
+ * @property {Number} size 星星的大小
38
+ * @property {Number} value/v-model 当前评分
39
+ * @property {Number} max 最大评分评分数量,目前一分一颗星
40
+ * @property {Number} margin 星星的间距,单位 px
41
+ * @property {Boolean} disabled = [true|false] 是否为禁用状态,默认为 false
42
+ * @property {Boolean} readonly = [true|false] 是否为只读状态,默认为 false
43
+ * @property {Boolean} allowHalf = [true|false] 是否实现半星,默认为 false
44
+ * @property {Boolean} touchable = [true|false] 是否支持滑动手势,默认为 true
45
+ * @event {Function} change uniRate 的 value 改变时触发事件,e={value:Number}
46
+ */
47
+
48
+ export default {
49
+ name: "UniRate",
50
+ props: {
51
+ isFill: {
52
+ // 星星的类型,是否镂空
53
+ type: [Boolean, String],
54
+ default: true
55
+ },
56
+ color: {
57
+ // 星星未选中的颜色
58
+ type: String,
59
+ default: "#ececec"
60
+ },
61
+ activeColor: {
62
+ // 星星选中状态颜色
63
+ type: String,
64
+ default: "#ffca3e"
65
+ },
66
+ disabledColor: {
67
+ // 星星禁用状态颜色
68
+ type: String,
69
+ default: "#c0c0c0"
70
+ },
71
+ size: {
72
+ // 星星的大小
73
+ type: [Number, String],
74
+ default: 24
75
+ },
76
+ value: {
77
+ // 当前评分
78
+ type: [Number, String],
79
+ default: 0
80
+ },
81
+ modelValue: {
82
+ // 当前评分
83
+ type: [Number, String],
84
+ default: 0
85
+ },
86
+ max: {
87
+ // 最大评分
88
+ type: [Number, String],
89
+ default: 5
90
+ },
91
+ margin: {
92
+ // 星星的间距
93
+ type: [Number, String],
94
+ default: 0
95
+ },
96
+ disabled: {
97
+ // 是否可点击
98
+ type: [Boolean, String],
99
+ default: false
100
+ },
101
+ readonly: {
102
+ // 是否只读
103
+ type: [Boolean, String],
104
+ default: false
105
+ },
106
+ allowHalf: {
107
+ // 是否显示半星
108
+ type: [Boolean, String],
109
+ default: false
110
+ },
111
+ touchable: {
112
+ // 是否支持滑动手势
113
+ type: [Boolean, String],
114
+ default: true
115
+ }
116
+ },
117
+ data() {
118
+ return {
119
+ valueSync: "",
120
+ userMouseFristMove: true,
121
+ userRated: false,
122
+ userLastRate: 1
123
+ };
124
+ },
125
+ watch: {
126
+ value(newVal) {
127
+ this.valueSync = Number(newVal);
128
+ },
129
+ modelValue(newVal) {
130
+ this.valueSync = Number(newVal);
131
+ },
132
+ },
133
+ computed: {
134
+ stars() {
135
+ const value = this.valueSync ? this.valueSync : 0;
136
+ const starList = [];
137
+ const floorValue = Math.floor(value);
138
+ const ceilValue = Math.ceil(value);
139
+ for (let i = 0; i < this.max; i++) {
140
+ if (floorValue > i) {
141
+ starList.push({
142
+ activeWitch: "100%"
143
+ });
144
+ } else if (ceilValue - 1 === i) {
145
+ starList.push({
146
+ activeWitch: (value - floorValue) * 100 + "%"
147
+ });
148
+ } else {
149
+ starList.push({
150
+ activeWitch: "0"
151
+ });
152
+ }
153
+ }
154
+ return starList;
155
+ },
156
+
157
+ marginNumber() {
158
+ return Number(this.margin)
159
+ }
160
+ },
161
+ created() {
162
+ this.valueSync = Number(this.value || this.modelValue);
163
+ this._rateBoxLeft = 0
164
+ this._oldValue = null
165
+ },
166
+ mounted() {
167
+ setTimeout(() => {
168
+ this._getSize()
169
+ }, 100)
170
+ // #ifdef H5
171
+ this.PC = this.IsPC()
172
+ // #endif
173
+ },
174
+ methods: {
175
+ touchstart(e) {
176
+ // #ifdef H5
177
+ if (this.IsPC()) return
178
+ // #endif
179
+ if (this.readonly || this.disabled) return
180
+ const {
181
+ clientX,
182
+ screenX
183
+ } = e.changedTouches[0]
184
+ // TODO 做一下兼容,只有 Nvue 下才有 screenX,其他平台式 clientX
185
+ this._getRateCount(clientX || screenX)
186
+ },
187
+ touchmove(e) {
188
+ // #ifdef H5
189
+ if (this.IsPC()) return
190
+ // #endif
191
+ if (this.readonly || this.disabled || !this.touchable) return
192
+ const {
193
+ clientX,
194
+ screenX
195
+ } = e.changedTouches[0]
196
+ this._getRateCount(clientX || screenX)
197
+ },
198
+
199
+ /**
200
+ * 兼容 PC @tian
201
+ */
202
+
203
+ mousedown(e) {
204
+ // #ifdef H5
205
+ if (!this.IsPC()) return
206
+ if (this.readonly || this.disabled) return
207
+ const {
208
+ clientX,
209
+ } = e
210
+ this.userLastRate = this.valueSync
211
+ this._getRateCount(clientX)
212
+ this.userRated = true
213
+ // #endif
214
+ },
215
+ mousemove(e) {
216
+ // #ifdef H5
217
+ if (!this.IsPC()) return
218
+ if (this.userRated) return
219
+ if (this.userMouseFristMove) {
220
+ console.log('---mousemove----', this.valueSync);
221
+ this.userLastRate = this.valueSync
222
+ this.userMouseFristMove = false
223
+ }
224
+ if (this.readonly || this.disabled || !this.touchable) return
225
+ const {
226
+ clientX,
227
+ } = e
228
+ this._getRateCount(clientX)
229
+ // #endif
230
+ },
231
+ mouseleave(e) {
232
+ // #ifdef H5
233
+ if (!this.IsPC()) return
234
+ if (this.readonly || this.disabled || !this.touchable) return
235
+ if (this.userRated) {
236
+ this.userRated = false
237
+ return
238
+ }
239
+ this.valueSync = this.userLastRate
240
+ // #endif
241
+ },
242
+ // #ifdef H5
243
+ IsPC() {
244
+ var userAgentInfo = navigator.userAgent;
245
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
246
+ var flag = true;
247
+ for (let v = 0; v < Agents.length - 1; v++) {
248
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
249
+ flag = false;
250
+ break;
251
+ }
252
+ }
253
+ return flag;
254
+ },
255
+ // #endif
256
+
257
+ /**
258
+ * 获取星星个数
259
+ */
260
+ _getRateCount(clientX) {
261
+ const _this = this;
262
+ this._getSize(function() {
263
+ const size = Number(_this.size)
264
+ if (isNaN(size)) {
265
+ return new Error('size 属性只能设置为数字')
266
+ }
267
+ const rateMoveRange = clientX - _this._rateBoxLeft
268
+ let index = parseInt(rateMoveRange / (size + _this.marginNumber))
269
+ index = index < 0 ? 0 : index;
270
+ index = index > _this.max ? _this.max : index;
271
+ const range = parseInt(rateMoveRange - (size + _this.marginNumber) * index);
272
+ let value = 0;
273
+ if (_this._oldValue === index && !_this.PC) return;
274
+ _this._oldValue = index;
275
+ if (_this.allowHalf) {
276
+ if (range > (size / 2)) {
277
+ value = index + 1
278
+ } else {
279
+ value = index + 0.5
280
+ }
281
+ } else {
282
+ value = index + 1
283
+ }
284
+
285
+ value = Math.max(0.5, Math.min(value, _this.max))
286
+ _this.valueSync = value
287
+ _this._onChange()
288
+ })
289
+ },
290
+
291
+ /**
292
+ * 触发动态修改
293
+ */
294
+ _onChange() {
295
+
296
+ this.$emit("input", this.valueSync);
297
+ this.$emit("update:modelValue", this.valueSync);
298
+ this.$emit("change", {
299
+ value: this.valueSync
300
+ });
301
+ },
302
+ /**
303
+ * 获取星星距离屏幕左侧距离
304
+ */
305
+ _getSize(fn) {
306
+ // #ifndef APP-NVUE
307
+ uni.createSelectorQuery()
308
+ .in(this)
309
+ .select('.uni-rate')
310
+ .boundingClientRect()
311
+ .exec(ret => {
312
+ if (ret) {
313
+ this._rateBoxLeft = ret[0].left
314
+ fn && fn()
315
+ }
316
+ })
317
+ // #endif
318
+ // #ifdef APP-NVUE
319
+ dom.getComponentRect(this.$refs['uni-rate'], (ret) => {
320
+ const size = ret.size
321
+ if (size) {
322
+ this._rateBoxLeft = size.left
323
+ fn && fn()
324
+ }
325
+ })
326
+ // #endif
327
+ }
328
+ }
329
+ };
330
+ </script>
331
+
332
+ <style lang="scss">
333
+ .uni-rate {
334
+ /* #ifndef APP-NVUE */
335
+ display: flex;
336
+ /* #endif */
337
+ line-height: 1;
338
+ font-size: 0;
339
+ flex-direction: row;
340
+ /* #ifdef H5 */
341
+ cursor: pointer;
342
+ /* #endif */
343
+ }
344
+
345
+ .uni-rate__icon {
346
+ position: relative;
347
+ line-height: 1;
348
+ font-size: 0;
349
+ }
350
+
351
+ .uni-rate__icon-on {
352
+ overflow: hidden;
353
+ position: absolute;
354
+ top: 0;
355
+ left: 0;
356
+ line-height: 1;
357
+ text-align: left;
358
+ }
359
+
360
+ .uni-cursor-not-allowed {
361
+ /* #ifdef H5 */
362
+ cursor: not-allowed !important;
363
+ /* #endif */
364
+ }
365
+ </style>
@@ -0,0 +1,190 @@
1
+ <template>
2
+ <view :class="[ 'uni-row', typeClass , justifyClass, alignClass, ]" :style="{
3
+ marginLeft:`${Number(marginValue)}rpx`,
4
+ marginRight:`${Number(marginValue)}rpx`,
5
+ }">
6
+ <slot></slot>
7
+ </view>
8
+ </template>
9
+
10
+ <script>
11
+ const ComponentClass = 'uni-row';
12
+ const modifierSeparator = '--';
13
+ /**
14
+ * Row 布局-行
15
+ * @description 流式栅格系统,随着屏幕或视口分为 24 份,可以迅速简便地创建布局。
16
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=3958
17
+ *
18
+ * @property {gutter} type = Number 栅格间隔
19
+ * @property {justify} type = String flex 布局下的水平排列方式
20
+ * 可选 start/end/center/space-around/space-between start
21
+ * 默认值 start
22
+ * @property {align} type = String flex 布局下的垂直排列方式
23
+ * 可选 top/middle/bottom
24
+ * 默认值 top
25
+ * @property {width} type = String|Number nvue下需要自行配置宽度用于计算
26
+ * 默认值 750
27
+ */
28
+
29
+
30
+ export default {
31
+ name: 'uniRow',
32
+ componentName: 'uniRow',
33
+ // #ifdef MP-WEIXIN
34
+ options: {
35
+ virtualHost: true // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现,可使用flex布局
36
+ },
37
+ // #endif
38
+ props: {
39
+ type: String,
40
+ gutter: Number,
41
+ justify: {
42
+ type: String,
43
+ default: 'start'
44
+ },
45
+ align: {
46
+ type: String,
47
+ default: 'top'
48
+ },
49
+ // nvue如果使用span等属性,需要配置宽度
50
+ width: {
51
+ type: [String, Number],
52
+ default: 750
53
+ }
54
+ },
55
+ created() {
56
+ // #ifdef APP-NVUE
57
+ this.type = 'flex';
58
+ // #endif
59
+ },
60
+ computed: {
61
+ marginValue() {
62
+ // #ifndef APP-NVUE
63
+ if (this.gutter) {
64
+ return -(this.gutter / 2);
65
+ }
66
+ // #endif
67
+ return 0;
68
+ },
69
+ typeClass() {
70
+ return this.type === 'flex' ? `${ComponentClass + modifierSeparator}flex` : '';
71
+ },
72
+ justifyClass() {
73
+ return this.justify !== 'start' ? `${ComponentClass + modifierSeparator}flex-justify-${this.justify}` : ''
74
+ },
75
+ alignClass() {
76
+ return this.align !== 'top' ? `${ComponentClass + modifierSeparator}flex-align-${this.align}` : ''
77
+ }
78
+ }
79
+ };
80
+ </script>
81
+
82
+ <style lang="scss">
83
+ $layout-namespace: ".uni-";
84
+ $row:$layout-namespace+"row";
85
+ $modifier-separator: "--";
86
+
87
+ @mixin utils-clearfix {
88
+ $selector: &;
89
+
90
+ @at-root {
91
+
92
+ /* #ifndef APP-NVUE */
93
+ #{$selector}::before,
94
+ #{$selector}::after {
95
+ display: table;
96
+ content: "";
97
+ }
98
+
99
+ #{$selector}::after {
100
+ clear: both;
101
+ }
102
+
103
+ /* #endif */
104
+ }
105
+
106
+ }
107
+
108
+ @mixin utils-flex ($direction: row) {
109
+ /* #ifndef APP-NVUE */
110
+ display: flex;
111
+ /* #endif */
112
+ flex-direction: $direction;
113
+ }
114
+
115
+ @mixin set-flex($state) {
116
+ @at-root &-#{$state} {
117
+ @content
118
+ }
119
+ }
120
+
121
+ #{$row} {
122
+ position: relative;
123
+ flex-direction: row;
124
+
125
+ /* #ifdef APP-NVUE */
126
+ flex: 1;
127
+ /* #endif */
128
+
129
+ /* #ifndef APP-NVUE */
130
+ box-sizing: border-box;
131
+ /* #endif */
132
+
133
+ // 非nvue使用float布局
134
+ @include utils-clearfix;
135
+
136
+ // 在QQ、字节、百度小程序平台,编译后使用shadow dom,不可使用flex布局,使用float
137
+ @at-root {
138
+
139
+ /* #ifndef MP-QQ || MP-TOUTIAO || MP-BAIDU */
140
+ &#{$modifier-separator}flex {
141
+ @include utils-flex;
142
+ flex-wrap: wrap;
143
+ flex: 1;
144
+
145
+ &:before,
146
+ &:after {
147
+ /* #ifndef APP-NVUE */
148
+ display: none;
149
+ /* #endif */
150
+ }
151
+
152
+ @include set-flex(justify-center) {
153
+ justify-content: center;
154
+ }
155
+
156
+ @include set-flex(justify-end) {
157
+ justify-content: flex-end;
158
+ }
159
+
160
+ @include set-flex(justify-space-between) {
161
+ justify-content: space-between;
162
+ }
163
+
164
+ @include set-flex(justify-space-around) {
165
+ justify-content: space-around;
166
+ }
167
+
168
+ @include set-flex(align-middle) {
169
+ align-items: center;
170
+ }
171
+
172
+ @include set-flex(align-bottom) {
173
+ align-items: flex-end;
174
+ }
175
+ }
176
+
177
+ /* #endif */
178
+ }
179
+
180
+ }
181
+
182
+ // 字节、QQ配置后不生效
183
+ // 此处用法无法使用
184
+ /* #ifdef MP-WEIXIN || MP-TOUTIAO || MP-QQ */
185
+ :host {
186
+ display: block;
187
+ }
188
+
189
+ /* #endif */
190
+ </style>
@@ -0,0 +1,8 @@
1
+ ## 1.0.3(2022-01-21)
2
+ - 优化 组件示例
3
+ ## 1.0.2(2021-11-22)
4
+ - 修复 / 符号在 vue 不同版本兼容问题引起的报错问题
5
+ ## 1.0.1(2021-11-22)
6
+ - 修复 vue3中scss语法兼容问题
7
+ ## 1.0.0(2021-11-18)
8
+ - init
@@ -0,0 +1 @@
1
+ @import 'index';
@@ -0,0 +1,82 @@
1
+ {
2
+ "id": "uni-scss",
3
+ "displayName": "uni-scss 辅助样式",
4
+ "version": "1.0.3",
5
+ "description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。",
6
+ "keywords": [
7
+ "uni-scss",
8
+ "uni-ui",
9
+ "辅助样式"
10
+ ],
11
+ "repository": "https://github.com/dcloudio/uni-ui",
12
+ "engines": {
13
+ "HBuilderX": "^3.1.0"
14
+ },
15
+ "dcloudext": {
16
+ "category": [
17
+ "JS SDK",
18
+ "通用 SDK"
19
+ ],
20
+ "sale": {
21
+ "regular": {
22
+ "price": "0.00"
23
+ },
24
+ "sourcecode": {
25
+ "price": "0.00"
26
+ }
27
+ },
28
+ "contact": {
29
+ "qq": ""
30
+ },
31
+ "declaration": {
32
+ "ads": "无",
33
+ "data": "无",
34
+ "permissions": "无"
35
+ },
36
+ "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
37
+ },
38
+ "uni_modules": {
39
+ "dependencies": [],
40
+ "encrypt": [],
41
+ "platforms": {
42
+ "cloud": {
43
+ "tcb": "y",
44
+ "aliyun": "y"
45
+ },
46
+ "client": {
47
+ "App": {
48
+ "app-vue": "y",
49
+ "app-nvue": "u"
50
+ },
51
+ "H5-mobile": {
52
+ "Safari": "y",
53
+ "Android Browser": "y",
54
+ "微信浏览器(Android)": "y",
55
+ "QQ浏览器(Android)": "y"
56
+ },
57
+ "H5-pc": {
58
+ "Chrome": "y",
59
+ "IE": "y",
60
+ "Edge": "y",
61
+ "Firefox": "y",
62
+ "Safari": "y"
63
+ },
64
+ "小程序": {
65
+ "微信": "y",
66
+ "阿里": "y",
67
+ "百度": "y",
68
+ "字节跳动": "y",
69
+ "QQ": "y"
70
+ },
71
+ "快应用": {
72
+ "华为": "n",
73
+ "联盟": "n"
74
+ },
75
+ "Vue": {
76
+ "vue2": "y",
77
+ "vue3": "y"
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,4 @@
1
+ `uni-sass` 是 `uni-ui`提供的一套全局样式 ,通过一些简单的类名和`sass`变量,实现简单的页面布局操作,比如颜色、边距、圆角等。
2
+
3
+ ### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass)
4
+ #### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
@@ -0,0 +1,7 @@
1
+ @import 'variables';
2
+ @import 'border';
3
+ @import 'color';
4
+ @import 'space';
5
+ @import 'radius';
6
+ @import 'text';
7
+ @import 'styles';
@@ -0,0 +1,3 @@
1
+ .uni-border {
2
+ border: 1px $uni-border-1 solid;
3
+ }