@10yun/cv-mobile-ui 0.5.30 → 0.5.32

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 (111) hide show
  1. package/package.json +5 -1
  2. package/ui-cv/components/cv-btn-base/cv-btn-base.vue +1 -1
  3. package/uview-plus/README.md +1 -1
  4. package/uview-plus/components/u-action-sheet/u-action-sheet.vue +8 -8
  5. package/uview-plus/components/u-album/u-album.vue +1 -1
  6. package/uview-plus/components/u-alert/u-alert.vue +5 -5
  7. package/uview-plus/components/u-app-update/u-app-update.vue +2 -2
  8. package/uview-plus/components/u-avatar/u-avatar.vue +2 -2
  9. package/uview-plus/components/u-avatar-group/u-avatar-group.vue +79 -3
  10. package/uview-plus/components/u-back-top/u-back-top.vue +4 -4
  11. package/uview-plus/components/u-badge/u-badge.vue +1 -1
  12. package/uview-plus/components/u-button/u-button.vue +8 -8
  13. package/uview-plus/components/u-button-wu/u-button-wu.vue +9 -9
  14. package/uview-plus/components/u-calendar/u-calendar.vue +5 -6
  15. package/uview-plus/components/u-car-keyboard/u-car-keyboard.vue +2 -2
  16. package/uview-plus/components/u-card/u-card.vue +139 -3
  17. package/uview-plus/components/u-cell/u-cell.vue +4 -4
  18. package/uview-plus/components/u-cell-group/u-cell-group.vue +2 -2
  19. package/uview-plus/components/u-checkbox/u-checkbox.vue +4 -4
  20. package/uview-plus/components/u-checkbox-group/u-checkbox-group.vue +1 -1
  21. package/uview-plus/components/u-code/u-code.vue +1 -1
  22. package/uview-plus/components/u-code-input/u-code-input.vue +1 -1
  23. package/uview-plus/components/u-col/u-col.vue +1 -1
  24. package/uview-plus/components/u-collapse/u-collapse.vue +2 -2
  25. package/uview-plus/components/u-collapse-item/u-collapse-item.vue +218 -3
  26. package/uview-plus/components/u-column-notice/u-column-notice.vue +3 -3
  27. package/uview-plus/components/u-copy/u-copy.vue +68 -1
  28. package/uview-plus/components/u-count-down/u-count-down.vue +1 -1
  29. package/uview-plus/components/u-count-to/u-count-to.vue +1 -1
  30. package/uview-plus/components/u-datetime-picker/u-datetime-picker.vue +3 -3
  31. package/uview-plus/components/u-divider/u-divider.vue +3 -3
  32. package/uview-plus/components/u-dropdown/u-dropdown.vue +3 -3
  33. package/uview-plus/components/u-dropdown-item/u-dropdown-item.vue +1 -1
  34. package/uview-plus/components/u-empty/u-empty.vue +3 -3
  35. package/uview-plus/components/u-form/u-form.vue +243 -1
  36. package/uview-plus/components/u-form-item/u-form-item.vue +4 -4
  37. package/uview-plus/components/u-gap/u-gap.vue +1 -1
  38. package/uview-plus/components/u-grid/u-grid.vue +1 -1
  39. package/uview-plus/components/u-grid-item/u-grid-item.vue +1 -1
  40. package/uview-plus/components/u-icon/u-icon.vue +1 -1
  41. package/uview-plus/components/u-icon/u-icon2.vue +1 -1
  42. package/uview-plus/components/u-image/u-image.vue +5 -5
  43. package/uview-plus/components/u-image-wu/u-image-wu.vue +5 -5
  44. package/uview-plus/components/u-index-anchor/u-index-anchor.vue +1 -1
  45. package/uview-plus/components/u-index-list/u-index-list.vue +2 -2
  46. package/uview-plus/components/u-input/u-input.vue +4 -4
  47. package/uview-plus/components/u-keyboard/u-keyboard.vue +6 -6
  48. package/uview-plus/components/u-lazy-load/u-lazy-load.vue +257 -3
  49. package/uview-plus/components/u-line/u-line.vue +1 -1
  50. package/uview-plus/components/u-line-progress/u-line-progress.vue +1 -1
  51. package/uview-plus/components/u-link/u-link.vue +1 -1
  52. package/uview-plus/components/u-list/u-list.vue +1 -1
  53. package/uview-plus/components/u-list-item/u-list-item.vue +1 -1
  54. package/uview-plus/components/u-loading-icon/u-loading-icon.vue +191 -3
  55. package/uview-plus/components/u-loading-page/u-loading-page.vue +4 -4
  56. package/uview-plus/components/u-loadmore/u-loadmore.vue +4 -4
  57. package/uview-plus/components/u-mask/u-mask.vue +120 -113
  58. package/uview-plus/components/u-message-input/u-message-input.vue +1 -1
  59. package/uview-plus/components/u-modal/u-modal.vue +6 -6
  60. package/uview-plus/components/u-navbar/u-navbar.vue +4 -4
  61. package/uview-plus/components/u-navbar-mini/u-navbar-mini.vue +2 -2
  62. package/uview-plus/components/u-navbar-wu/u-navbar-wu.vue +4 -4
  63. package/uview-plus/components/u-no-network/u-no-network.vue +5 -5
  64. package/uview-plus/components/u-notice-bar/u-notice-bar.vue +5 -5
  65. package/uview-plus/components/u-notify/u-notify.vue +6 -6
  66. package/uview-plus/components/u-number-box/u-number-box.vue +9 -3
  67. package/uview-plus/components/u-number-keyboard/u-number-keyboard.vue +1 -1
  68. package/uview-plus/components/u-overlay/u-overlay.vue +3 -3
  69. package/uview-plus/components/u-picker/u-picker.vue +5 -5
  70. package/uview-plus/components/u-popup/u-popup.vue +8 -8
  71. package/uview-plus/components/u-popup-wu/u-popup-wu.vue +7 -7
  72. package/uview-plus/components/u-qrcode/u-qrcode.vue +275 -3
  73. package/uview-plus/components/u-radio/u-radio.vue +4 -4
  74. package/uview-plus/components/u-radio-group/u-radio-group.vue +1 -1
  75. package/uview-plus/components/u-rate/u-rate.vue +5 -5
  76. package/uview-plus/components/u-read-more/u-read-more.vue +126 -3
  77. package/uview-plus/components/u-row/u-row.vue +1 -1
  78. package/uview-plus/components/u-row-notice/u-row-notice.vue +3 -3
  79. package/uview-plus/components/u-safe-bottom/u-safe-bottom.vue +48 -3
  80. package/uview-plus/components/u-search/u-search.vue +4 -4
  81. package/uview-plus/components/u-select/u-select.vue +175 -3
  82. package/uview-plus/components/u-skeleton/u-skeleton.vue +3 -3
  83. package/uview-plus/components/u-sku-wu/u-sku-wu.vue +4 -4
  84. package/uview-plus/components/u-status-bar/u-status-bar.vue +1 -1
  85. package/uview-plus/components/u-steps/u-steps.vue +1 -1
  86. package/uview-plus/components/u-steps-item/u-steps-item.vue +7 -7
  87. package/uview-plus/components/u-sticky/u-sticky.vue +1 -1
  88. package/uview-plus/components/u-subsection/u-subsection.vue +1 -1
  89. package/uview-plus/components/u-swipe-action/u-swipe-action.vue +1 -1
  90. package/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue +3 -3
  91. package/uview-plus/components/u-swiper/u-swiper.vue +1 -1
  92. package/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue +1 -1
  93. package/uview-plus/components/u-switch/u-switch.vue +2 -2
  94. package/uview-plus/components/u-tabbar/u-tabbar.vue +2 -2
  95. package/uview-plus/components/u-tabbar-item/u-tabbar-item.vue +9 -4
  96. package/uview-plus/components/u-table/u-table.vue +1 -1
  97. package/uview-plus/components/u-tabs/u-tabs.vue +3 -3
  98. package/uview-plus/components/u-tag/u-tag.vue +5 -5
  99. package/uview-plus/components/u-text/u-text.vue +159 -3
  100. package/uview-plus/components/u-toast/u-toast.vue +8 -8
  101. package/uview-plus/components/u-tooltip/u-tooltip.vue +6 -6
  102. package/uview-plus/components/u-upload/u-upload.vue +10 -10
  103. package/uview-plus/components/u-waterfall/u-waterfall.vue +221 -3
  104. package/uview-plus/index.js +4 -2
  105. package/uview-plus/libs/ctocode/image.js +17 -0
  106. package/uview-plus/libs/ctocode/index.js +150 -0
  107. package/uview-plus/libs/ctocode/map.js +38 -0
  108. package/uview-plus/libs/function/index-wu.js +6 -34
  109. package/uview-plus/package.json +3 -3
  110. package/uview-plus/readme-wu.md +1 -1
  111. package/uview-plus/libs/function/cc.js +0 -66
@@ -1,3 +1,218 @@
1
- <template>
2
1
  <view class="u-collapse-item">
3
2
  <u-cell
4
3
  :title="$slots.title ? '' : title"
5
4
  :value="value"
6
5
  :label="label"
7
6
  :icon="icon"
8
7
  :isLink="isLink"
9
8
  :clickable="clickable"
10
9
  :border="parentData.border && showBorder"
11
10
  @click="clickHandler"
12
11
  :arrowDirection="expanded ? 'up' : 'down'"
13
12
  :disabled="disabled"
14
13
  :customClass="cellCustomClass"
15
14
  :customStyle="cellCustomStyle"
16
15
  >
17
16
  <!-- 微信小程序不支持,因为微信中不支持 <slot name="title" #title />的写法 -->
18
17
  <template #title>
19
18
  <slot name="title">
20
19
  <text v-if="!$slots.title && title">
21
20
  {{ title }}
22
21
  </text>
23
22
  </slot>
24
23
  </template>
25
24
  <template #icon>
26
25
  <slot name="icon">
27
26
  <u-icon v-if="!$slots.icon && icon" :size="22" :name="icon"></u-icon>
28
27
  </slot>
29
28
  </template>
30
29
  <template #value>
31
30
  <slot name="value">
32
31
  <text v-if="!$slots.value && value">
33
32
  {{ value }}
34
33
  </text>
35
34
  </slot>
36
35
  </template>
37
36
  <template #right-icon>
38
37
  <template v-if="showRight">
39
38
  <u-icon v-if="!$slots['right-icon']" :size="16" name="arrow-right"></u-icon>
40
39
  <slot name="right-icon"></slot>
41
40
  </template>
42
41
  </template>
43
42
  </u-cell>
44
43
  <view class="u-collapse-item__content" :animation="animationData" ref="animation">
45
44
  <view class="u-collapse-item__content__text content-class" :id="elId" :ref="elId"><slot /></view>
46
45
  </view>
47
46
  <u-line v-if="parentData.border"></u-line>
48
47
  </view>
49
48
  * collapseItem 折叠面板Item
50
49
  * @description 通过折叠面板收纳内容区域(搭配u-collapse使用)
51
50
  * @tutorial https://ijry.github.io/uview-plus/components/collapse.html
52
51
  * @property {String} title 标题
53
52
  * @property {String} value 标题右侧内容
54
53
  * @property {String} label 标题下方的描述信息
55
54
  * @property {Boolean} disbled 是否禁用折叠面板 ( 默认 false )
56
55
  * @property {Boolean} isLink 是否展示右侧箭头并开启点击反馈 ( 默认 true )
57
56
  * @property {Boolean} clickable 是否开启点击反馈 ( 默认 true )
58
57
  * @property {Boolean} border 是否显示内边框 ( 默认 true )
59
58
  * @property {String} align 标题的对齐方式 ( 默认 'left' )
60
59
  * @property {String | Number} name 唯一标识符
61
60
  * @property {String} icon 标题左侧图片,可为绝对路径的图片或内置图标
62
61
  * @event {Function} change 某个item被打开或者收起时触发
63
62
  * @example <u-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">{{item.body}}</u-collapse-item>
64
63
  */
65
64
  name: 'u-collapse-item',
66
65
  mixins: [mpMixin, mixin, props],
67
66
  data() {
68
67
  return {
69
68
  elId: guid(),
70
69
  // uni.createAnimation的导出数据
71
70
  animationData: {},
72
71
  // 是否展开状态
73
72
  expanded: false,
74
73
  // 根据expanded确定是否显示border,为了控制展开时,cell的下划线更好的显示效果,进行一定时间的延时
75
74
  showBorder: false,
76
75
  // 是否动画中,如果是则不允许继续触发点击
77
76
  animating: false,
78
77
  // 父组件u-collapse的参数
79
78
  parentData: {
80
79
  accordion: false,
81
80
  border: false
82
81
  }
83
82
  };
84
83
  },
85
84
  watch: {
86
85
  expanded(n) {
87
86
  clearTimeout(this.timer);
88
87
  this.timer = null;
89
88
  // 这里根据expanded的值来进行一定的延时,是为了cell的下划线更好的显示效果
90
89
  this.timer = setTimeout(
91
90
  () => {
92
91
  this.showBorder = n;
93
92
  },
94
93
  n ? 10 : 290
95
94
  );
96
95
  }
97
96
  },
98
97
  mounted() {
99
98
  this.init();
100
99
  // console.log('$slots', this.$slots)
101
100
  },
102
101
  methods: {
103
102
  // 异步获取内容,或者动态修改了内容时,需要重新初始化
104
103
  async init() {
105
104
  // 初始化数据
106
105
  this.updateParentData();
107
106
  if (!this.parent) {
108
107
  return error('u-collapse-item必须要搭配u-collapse组件使用');
109
108
  }
110
109
  const { value, accordion, children = [] } = this.parent;
111
110
  if (accordion) {
112
111
  if (test.array(value)) {
113
112
  return error('手风琴模式下,u-collapse组件的value参数不能为数组');
114
113
  }
115
114
  this.expanded = this.name == value;
116
115
  } else {
117
116
  if (!test.array(value) && value !== null) {
118
117
  return error('非手风琴模式下,u-collapse组件的value参数必须为数组');
119
118
  }
120
119
  this.expanded = (value || []).some((item) => item == this.name);
121
120
  }
122
121
  // 设置组件的展开或收起状态
123
122
  await nextTick();
124
123
  this.setContentAnimate();
125
124
  },
126
125
  updateParentData() {
127
126
  // 此方法在mixin中
128
127
  this.getParentData('u-collapse');
129
128
  },
130
129
  async setContentAnimate() {
131
130
  // 每次面板打开或者收起时,都查询元素尺寸
132
131
  // 好处是,父组件从服务端获取内容后,变更折叠面板后可以获得最新的高度
133
132
  const rect = await this.queryRect();
134
133
  const height = this.expanded ? rect.height : 0;
135
134
  this.animating = true;
136
135
  // #ifdef APP-NVUE
137
136
  const ref = this.$refs['animation'].ref;
138
137
  animation.transition(
139
138
  ref,
140
139
  {
141
140
  styles: {
142
141
  height: height + 'px'
143
142
  },
144
143
  duration: this.duration,
145
144
  // 必须设置为true,否则会到面板收起或展开时,页面其他元素不会随之调整它们的布局
146
145
  needLayout: true,
147
146
  timingFunction: 'ease-in-out'
148
147
  },
149
148
  () => {
150
149
  this.animating = false;
151
150
  }
152
151
  );
153
152
  // #endif
154
153
  // #ifndef APP-NVUE
155
154
  const animation = uni.createAnimation({
156
155
  timingFunction: 'ease-in-out'
157
156
  });
158
157
  animation
159
158
  .height(height)
160
159
  .step({
161
160
  duration: this.duration
162
161
  })
163
162
  .step();
164
163
  // 导出动画数据给面板的animationData值
165
164
  this.animationData = animation.export();
166
165
  // 标识动画结束
167
166
  sleep(this.duration).then(() => {
168
167
  this.animating = false;
169
168
  });
170
169
  // #endif
171
170
  },
172
171
  // 点击collapsehead头部
173
172
  clickHandler() {
174
173
  if (this.disabled && this.animating) return;
175
174
  // 设置本组件为相反的状态
176
175
  this.parent && this.parent.onChange(this);
177
176
  },
178
177
  // 查询内容高度
179
178
  queryRect() {
180
179
  // #ifndef APP-NVUE
181
180
  // $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://ijry.github.io/uview-plus/js/getRect.html
182
181
  // 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
183
182
  return new Promise((resolve) => {
184
183
  this.$uGetRect(`#${this.elId}`).then((size) => {
185
184
  resolve(size);
186
185
  });
187
186
  });
188
187
  // #endif
189
188
  // #ifdef APP-NVUE
190
189
  // nvue下,使用dom模块查询元素高度
191
190
  // 返回一个promise,让调用此方法的主体能使用then回调
192
191
  return new Promise((resolve) => {
193
192
  dom.getComponentRect(this.$refs[this.elId], (res) => {
194
193
  resolve(res.size);
195
194
  });
196
195
  });
197
196
  // #endif
198
197
  }
199
198
  }
200
- @import './style.css';
201
- </style>
199
+ <template>
200
+ <view class="u-collapse-item">
201
+ <up-cell
202
+ :title="$slots.title ? '' : title"
203
+ :value="value"
204
+ :label="label"
205
+ :icon="icon"
206
+ :isLink="isLink"
207
+ :clickable="clickable"
208
+ :border="parentData.border && showBorder"
209
+ @click="clickHandler"
210
+ :arrowDirection="expanded ? 'up' : 'down'"
211
+ :disabled="disabled"
212
+ :customClass="cellCustomClass"
213
+ :customStyle="cellCustomStyle"
214
+ >
215
+ <!-- 微信小程序不支持,因为微信中不支持 <slot name="title" #title />的写法 -->
216
+ <template #title>
217
+ <slot name="title">
218
+ <text v-if="!$slots.title && title">
219
+ {{ title }}
220
+ </text>
221
+ </slot>
222
+ </template>
223
+ <template #icon>
224
+ <slot name="icon">
225
+ <up-icon v-if="!$slots.icon && icon" :size="22" :name="icon"></up-icon>
226
+ </slot>
227
+ </template>
228
+ <template #value>
229
+ <slot name="value">
230
+ <text v-if="!$slots.value && value">
231
+ {{ value }}
232
+ </text>
233
+ </slot>
234
+ </template>
235
+ <template #right-icon>
236
+ <template v-if="showRight">
237
+ <up-icon v-if="!$slots['right-icon']" :size="16" name="arrow-right"></up-icon>
238
+ <slot name="right-icon"></slot>
239
+ </template>
240
+ </template>
241
+ </up-cell>
242
+ <view class="u-collapse-item__content" :animation="animationData" ref="animation">
243
+ <view class="u-collapse-item__content__text content-class" :id="elId" :ref="elId"><slot /></view>
244
+ </view>
245
+ <up-line v-if="parentData.border"></up-line>
246
+ </view>
247
+ </template>
248
+ <script>
249
+ import { props } from './props.js';
250
+ import { mpMixin } from '../../libs/mixin/mpMixin';
251
+ import { mixin } from '../../libs/mixin/mixin';
252
+ import { nextTick } from 'vue';
253
+ import { guid, sleep, error } from '../../libs/function/index';
254
+ import test from '../../libs/function/test';
255
+ // #ifdef APP-NVUE
256
+ const animation = uni.requireNativePlugin('animation');
257
+ const dom = uni.requireNativePlugin('dom');
258
+ // #endif
259
+ /**
260
+ * collapseItem 折叠面板Item
261
+ * @description 通过折叠面板收纳内容区域(搭配u-collapse使用)
262
+ * @tutorial https://ijry.github.io/uview-plus/components/collapse.html
263
+ * @property {String} title 标题
264
+ * @property {String} value 标题右侧内容
265
+ * @property {String} label 标题下方的描述信息
266
+ * @property {Boolean} disbled 是否禁用折叠面板 ( 默认 false )
267
+ * @property {Boolean} isLink 是否展示右侧箭头并开启点击反馈 ( 默认 true )
268
+ * @property {Boolean} clickable 是否开启点击反馈 ( 默认 true )
269
+ * @property {Boolean} border 是否显示内边框 ( 默认 true )
270
+ * @property {String} align 标题的对齐方式 ( 默认 'left' )
271
+ * @property {String | Number} name 唯一标识符
272
+ * @property {String} icon 标题左侧图片,可为绝对路径的图片或内置图标
273
+ * @event {Function} change 某个item被打开或者收起时触发
274
+ * @example <up-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">{{item.body}}</up-collapse-item>
275
+ */
276
+ export default {
277
+ name: 'u-collapse-item',
278
+ mixins: [mpMixin, mixin, props],
279
+ data() {
280
+ return {
281
+ elId: guid(),
282
+ // uni.createAnimation的导出数据
283
+ animationData: {},
284
+ // 是否展开状态
285
+ expanded: false,
286
+ // 根据expanded确定是否显示border,为了控制展开时,cell的下划线更好的显示效果,进行一定时间的延时
287
+ showBorder: false,
288
+ // 是否动画中,如果是则不允许继续触发点击
289
+ animating: false,
290
+ // 父组件u-collapse的参数
291
+ parentData: {
292
+ accordion: false,
293
+ border: false
294
+ }
295
+ };
296
+ },
297
+ watch: {
298
+ expanded(n) {
299
+ clearTimeout(this.timer);
300
+ this.timer = null;
301
+ // 这里根据expanded的值来进行一定的延时,是为了cell的下划线更好的显示效果
302
+ this.timer = setTimeout(
303
+ () => {
304
+ this.showBorder = n;
305
+ },
306
+ n ? 10 : 290
307
+ );
308
+ }
309
+ },
310
+ mounted() {
311
+ this.init();
312
+ // console.log('$slots', this.$slots)
313
+ },
314
+ methods: {
315
+ // 异步获取内容,或者动态修改了内容时,需要重新初始化
316
+ async init() {
317
+ // 初始化数据
318
+ this.updateParentData();
319
+ if (!this.parent) {
320
+ return error('u-collapse-item必须要搭配u-collapse组件使用');
321
+ }
322
+ const { value, accordion, children = [] } = this.parent;
323
+ if (accordion) {
324
+ if (test.array(value)) {
325
+ return error('手风琴模式下,u-collapse组件的value参数不能为数组');
326
+ }
327
+ this.expanded = this.name == value;
328
+ } else {
329
+ if (!test.array(value) && value !== null) {
330
+ return error('非手风琴模式下,u-collapse组件的value参数必须为数组');
331
+ }
332
+ this.expanded = (value || []).some((item) => item == this.name);
333
+ }
334
+ // 设置组件的展开或收起状态
335
+ await nextTick();
336
+ this.setContentAnimate();
337
+ },
338
+ updateParentData() {
339
+ // 此方法在mixin中
340
+ this.getParentData('u-collapse');
341
+ },
342
+ async setContentAnimate() {
343
+ // 每次面板打开或者收起时,都查询元素尺寸
344
+ // 好处是,父组件从服务端获取内容后,变更折叠面板后可以获得最新的高度
345
+ const rect = await this.queryRect();
346
+ const height = this.expanded ? rect.height : 0;
347
+ this.animating = true;
348
+ // #ifdef APP-NVUE
349
+ const ref = this.$refs['animation'].ref;
350
+ animation.transition(
351
+ ref,
352
+ {
353
+ styles: {
354
+ height: height + 'px'
355
+ },
356
+ duration: this.duration,
357
+ // 必须设置为true,否则会到面板收起或展开时,页面其他元素不会随之调整它们的布局
358
+ needLayout: true,
359
+ timingFunction: 'ease-in-out'
360
+ },
361
+ () => {
362
+ this.animating = false;
363
+ }
364
+ );
365
+ // #endif
366
+ // #ifndef APP-NVUE
367
+ const animation = uni.createAnimation({
368
+ timingFunction: 'ease-in-out'
369
+ });
370
+ animation
371
+ .height(height)
372
+ .step({
373
+ duration: this.duration
374
+ })
375
+ .step();
376
+ // 导出动画数据给面板的animationData值
377
+ this.animationData = animation.export();
378
+ // 标识动画结束
379
+ sleep(this.duration).then(() => {
380
+ this.animating = false;
381
+ });
382
+ // #endif
383
+ },
384
+ // 点击collapsehead头部
385
+ clickHandler() {
386
+ if (this.disabled && this.animating) return;
387
+ // 设置本组件为相反的状态
388
+ this.parent && this.parent.onChange(this);
389
+ },
390
+ // 查询内容高度
391
+ queryRect() {
392
+ // #ifndef APP-NVUE
393
+ // $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://ijry.github.io/uview-plus/js/getRect.html
394
+ // 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
395
+ return new Promise((resolve) => {
396
+ this.$uGetRect(`#${this.elId}`).then((size) => {
397
+ resolve(size);
398
+ });
399
+ });
400
+ // #endif
401
+ // #ifdef APP-NVUE
402
+ // nvue下,使用dom模块查询元素高度
403
+ // 返回一个promise,让调用此方法的主体能使用then回调
404
+ return new Promise((resolve) => {
405
+ dom.getComponentRect(this.$refs[this.elId], (res) => {
406
+ resolve(res.size);
407
+ });
408
+ });
409
+ // #endif
410
+ }
411
+ }
412
+ };
413
+ </script>
414
+ <style scoped>
415
+ @import './style.css';
416
+ </style>
@@ -2,7 +2,7 @@
2
2
  <view class="u-notice" @tap="clickHandler">
3
3
  <slot name="icon">
4
4
  <view class="u-notice__left-icon" v-if="icon">
5
- <u-icon :name="icon" :color="color" size="19"></u-icon>
5
+ <up-icon :name="icon" :color="color" size="19"></up-icon>
6
6
  </view>
7
7
  </slot>
8
8
  <swiper
@@ -24,8 +24,8 @@
24
24
  </swiper-item>
25
25
  </swiper>
26
26
  <view class="u-notice__right-icon" v-if="['link', 'closable'].includes(mode)">
27
- <u-icon v-if="mode === 'link'" name="arrow-right" :size="17" :color="color"></u-icon>
28
- <u-icon v-if="mode === 'closable'" name="close" :size="16" :color="color" @click="close"></u-icon>
27
+ <up-icon v-if="mode === 'link'" name="arrow-right" :size="17" :color="color"></up-icon>
28
+ <up-icon v-if="mode === 'closable'" name="close" :size="16" :color="color" @click="close"></up-icon>
29
29
  </view>
30
30
  </view>
31
31
  </template>
@@ -1 +1,68 @@
1
- <template>
2
1
  <view @click="handleClick">
3
2
  <slot>复制</slot>
4
3
  </view>
5
4
  name: 'up-copy',
6
5
  props: {
7
6
  content: {
8
7
  type: String,
9
8
  default: ''
10
9
  },
11
10
  alertStyle: {
12
11
  type: String,
13
12
  default: 'toast'
14
13
  },
15
14
  notice: {
16
15
  type: String,
17
16
  default: '复制成功'
18
17
  }
19
18
  },
20
19
  emits: ['success'],
21
20
  methods: {
22
21
  handleClick() {
23
22
  let content = this.content;
24
23
  if (!content) {
25
24
  uni.showToast({
26
25
  title: '暂无',
27
26
  icon: 'none',
28
27
  duration: 2000
29
28
  });
30
29
  return false;
31
30
  }
32
31
  content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
33
32
  /**
34
33
  * 小程序端 和 app端的复制逻辑
35
34
  */
36
35
  let that = this;
37
36
  uni.setClipboardData({
38
37
  data: content,
39
38
  success: function () {
40
39
  if (that.alertStyle == 'modal') {
41
40
  uni.showModal({
42
41
  title: '提示',
43
42
  content: that.notice
44
43
  });
45
44
  } else {
46
45
  uni.showToast({
47
46
  title: that.notice,
48
47
  icon: 'none'
49
48
  });
50
49
  }
51
50
  that.$emit('success');
52
51
  },
53
52
  fail: function () {
54
53
  uni.showToast({
55
54
  title: '复制失败',
56
55
  icon: 'none',
57
56
  duration: 3000
58
57
  });
59
58
  }
60
59
  });
61
60
  }
62
61
  }
62
+ <template>
63
+ <view @click="handleClick">
64
+ <slot>复制</slot>
65
+ </view>
66
+ </template>
67
+ <script>
68
+ export default {
69
+ name: 'up-copy',
70
+ props: {
71
+ content: {
72
+ type: String,
73
+ default: ''
74
+ },
75
+ alertStyle: {
76
+ type: String,
77
+ default: 'toast'
78
+ },
79
+ notice: {
80
+ type: String,
81
+ default: '复制成功'
82
+ }
83
+ },
84
+ emits: ['success'],
85
+ methods: {
86
+ handleClick() {
87
+ let content = this.content;
88
+ if (!content) {
89
+ uni.showToast({
90
+ title: '暂无',
91
+ icon: 'none',
92
+ duration: 2000
93
+ });
94
+ return false;
95
+ }
96
+ content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
97
+ /**
98
+ * 小程序端 和 app端的复制逻辑
99
+ */
100
+ let that = this;
101
+ uni.setClipboardData({
102
+ data: content,
103
+ success: function () {
104
+ if (that.alertStyle == 'modal') {
105
+ uni.showModal({
106
+ title: '提示',
107
+ content: that.notice
108
+ });
109
+ } else {
110
+ uni.showToast({
111
+ title: that.notice,
112
+ icon: 'none'
113
+ });
114
+ }
115
+ that.$emit('success');
116
+ },
117
+ fail: function () {
118
+ uni.showToast({
119
+ title: '复制失败',
120
+ icon: 'none',
121
+ duration: 3000
122
+ });
123
+ }
124
+ });
125
+ }
126
+ }
127
+ };
128
+ </script>
129
+ <style scoped></style>
@@ -23,7 +23,7 @@ import { isSameSecond, parseFormat, parseTimeData } from './utils';
23
23
  * @event {Function} start 开始倒计时
24
24
  * @event {Function} pause 暂停倒计时
25
25
  * @event {Function} reset 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
26
- * @example <u-count-down :time="time"></u-count-down>
26
+ * @example <up-count-down :time="time"></up-count-down>
27
27
  */
28
28
  export default {
29
29
  name: 'u-count-down',
@@ -31,7 +31,7 @@ import { addUnit } from '../../libs/function/index';
31
31
  * @property {Boolean} bold 字体是否加粗(默认 false )
32
32
  * @property {String} separator 千位分隔符,见官网说明
33
33
  * @event {Function} end 数值滚动到目标值时触发
34
- * @example <u-count-to ref="uCountTo" :end-val="endVal" :autoplay="autoplay"></u-count-to>
34
+ * @example <up-count-to ref="uCountTo" :end-val="endVal" :autoplay="autoplay"></up-count-to>
35
35
  */
36
36
  export default {
37
37
  name: 'u-count-to',
@@ -6,7 +6,7 @@
6
6
  <div class="input-cover"></div>
7
7
  </slot>
8
8
  </view>
9
- <u-picker
9
+ <up-picker
10
10
  ref="picker"
11
11
  :show="show || (hasInput && showByClickInput)"
12
12
  :popupMode="popupMode"
@@ -33,7 +33,7 @@
33
33
  <template #toolbar-bottom>
34
34
  <slot name="toolbar-bottom"></slot>
35
35
  </template>
36
- </u-picker>
36
+ </up-picker>
37
37
  </view>
38
38
  </template>
39
39
  <script>
@@ -81,7 +81,7 @@ import test from '../../libs/function/test';
81
81
  * @event {Function} confirm 点击确定按钮,返回当前选择的值
82
82
  * @event {Function} change 当选择值变化时触发
83
83
  * @event {Function} cancel 点击取消按钮
84
- * @example <u-datetime-picker :show="show" :value="value1" mode="datetime" ></u-datetime-picker>
84
+ * @example <up-datetime-picker :show="show" :value="value1" mode="datetime" ></up-datetime-picker>
85
85
  */
86
86
  export default {
87
87
  name: 'up-datetime-picker',
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <view class="u-divider" :style="[addStyle(customStyle)]" @tap="click">
3
- <u-line :color="lineColor" :customStyle="leftLineStyle" :hairline="hairline" :dashed="dashed"></u-line>
3
+ <up-line :color="lineColor" :customStyle="leftLineStyle" :hairline="hairline" :dashed="dashed"></up-line>
4
4
  <text v-if="dot" class="u-divider__dot">●</text>
5
5
  <text v-else-if="text" class="u-divider__text" :style="[textStyle]">{{ text }}</text>
6
- <u-line :color="lineColor" :customStyle="rightLineStyle" :hairline="hairline" :dashed="dashed"></u-line>
6
+ <up-line :color="lineColor" :customStyle="rightLineStyle" :hairline="hairline" :dashed="dashed"></up-line>
7
7
  </view>
8
8
  </template>
9
9
  <script>
@@ -26,7 +26,7 @@ import { addStyle, addUnit } from '../../libs/function/index';
26
26
  * @property {Object} customStyle 定义需要用到的外部样式
27
27
  *
28
28
  * @event {Function} click divider组件被点击时触发
29
- * @example <u-divider :color="color">锦瑟无端五十弦</u-divider>
29
+ * @example <up-divider :color="color">锦瑟无端五十弦</up-divider>
30
30
  */
31
31
  export default {
32
32
  name: 'u-divider',
@@ -26,12 +26,12 @@
26
26
  'u-dropdown__menu__item__arrow--rotate': index === current
27
27
  }"
28
28
  >
29
- <u-icon
29
+ <up-icon
30
30
  :custom-style="{ display: 'flex' }"
31
31
  :name="menuIcon"
32
32
  :size="addUnit(menuIconSize)"
33
33
  :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'"
34
- ></u-icon>
34
+ ></up-icon>
35
35
  </view>
36
36
  </view>
37
37
  </view>
@@ -75,7 +75,7 @@ import { addUnit, getWindowInfo } from '../../libs/function/index';
75
75
  * @property {String | Number} title-size 标题的字体大小,单位任意,数值默认为rpx单位(默认28)
76
76
  * @event {Function} open 下拉菜单被打开时触发
77
77
  * @event {Function} close 下拉菜单被关闭时触发
78
- * @example <u-dropdown></u-dropdown>
78
+ * @example <up-dropdown></up-dropdown>
79
79
  */
80
80
  export default {
81
81
  name: 'u-dropdown',
@@ -44,7 +44,7 @@ import { addUnit, $parent } from '../../libs/function/index';
44
44
  * @property {Boolean} disabled 是否禁用此选项卡(默认false)
45
45
  * @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
46
46
  * @property {String | Number} height 弹窗下拉内容的高度(内容超出将会滚动)(默认auto)
47
- * @example <u-dropdown-item title="标题"></u-dropdown-item>
47
+ * @example <up-dropdown-item title="标题"></up-dropdown-item>
48
48
  */
49
49
  export default {
50
50
  name: 'u-dropdown-item',