uview-pro 0.0.4 → 0.0.6

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.
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * we-cropper v1.3.9
3
4
  * (c) 2020 dlhandsome
@@ -15,7 +15,7 @@
15
15
  :hover-stay-time="Number(hoverStayTime)"
16
16
  :disabled="disabled"
17
17
  :form-type="formType"
18
- :open-type="openType"
18
+ :open-type="disabled || loading ? undefined : openType"
19
19
  :app-parameter="appParameter"
20
20
  :hover-stop-propagation="hoverStopPropagation"
21
21
  :send-message-title="sendMessageTitle"
@@ -25,11 +25,15 @@
25
25
  :session-from="sessionFrom"
26
26
  :send-message-img="sendMessageImg"
27
27
  :show-message-card="showMessageCard"
28
- @getphonenumber="getphonenumber"
28
+ @getAuthorize="getAuthorize"
29
29
  @getuserinfo="getuserinfo"
30
+ @contact="contact"
31
+ @getphonenumber="getphonenumber"
30
32
  @error="error"
31
- @opensetting="opensetting"
32
33
  @launchapp="launchapp"
34
+ @opensetting="opensetting"
35
+ @chooseavatar="chooseavatar"
36
+ @agreeprivacyauthorization="agreeprivacyauthorization"
33
37
  :style="[
34
38
  customStyle,
35
39
  {
@@ -57,7 +61,7 @@
57
61
  </template>
58
62
 
59
63
  <script setup lang="ts">
60
- import { ref, computed, nextTick } from 'vue';
64
+ import { ref, computed, nextTick, type PropType } from 'vue';
61
65
  import { $u } from '../../';
62
66
 
63
67
  defineOptions({
@@ -74,7 +78,7 @@ defineOptions({
74
78
  * @property {Boolean} plain 按钮是否镂空,背景色透明
75
79
  * @property {Boolean} disabled 是否禁用
76
80
  * @property {Boolean} hair-line 是否显示按钮的细边框(默认true)
77
- * @property {Boolean} shape 按钮外观形状,见文档说明
81
+ * @property {String} shape 按钮外观形状,见文档说明
78
82
  * @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈)
79
83
  * @property {String} form-type 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
80
84
  * @property {String} open-type 开放能力
@@ -83,23 +87,60 @@ defineOptions({
83
87
  * @property {Number} hover-start-time 按住后多久出现点击态,单位毫秒
84
88
  * @property {Number} hover-stay-time 手指松开后点击态保留时间,单位毫秒
85
89
  * @property {Object} custom-style 对按钮的自定义样式,对象形式,见文档说明
90
+ * @property {String} app-parameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
91
+ * @property {Boolean} hover-stop-propagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
92
+ * @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
93
+ * @property {String} session-from 会话来源,open-type="contact"时有效。只微信小程序有效
94
+ * @property {String} send-message-title 会话内消息卡片标题,open-type="contact"时有效
95
+ * @property {String} send-message-path 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
96
+ * @property {String} send-message-img 会话内消息卡片图片,open-type="contact"时有效
97
+ * @property {Boolean} show-message-card 是否显示会话内消息卡片,open-type="contact"时有效
98
+ * @property {Number|String} throttle-time 节流,一定时间内只能触发一次,单位毫秒
99
+ * @property {String} scope 支付宝小程序,当 open-type 为 getAuthorize 时有效。可选值:'phoneNumber' | 'userInfo'
86
100
  * @event {Function} click 按钮点击
87
101
  * @event {Function} getphonenumber open-type="getPhoneNumber"时有效
88
102
  * @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
89
103
  * @event {Function} error 当使用开放能力时,发生错误的回调
90
104
  * @event {Function} opensetting 在打开授权设置页并关闭后回调
91
105
  * @event {Function} launchapp 打开 APP 成功的回调
106
+ * @event {Function} contact 客服消息回调
107
+ * @event {Function} chooseavatar 头像选择回调
108
+ * @event {Function} agreeprivacyauthorization 用户点击允许授权回调
92
109
  * @example <u-button>月落</u-button>
93
110
  */
94
111
 
95
- const emit = defineEmits<{
96
- (e: 'click', event: any): void;
97
- (e: 'getphonenumber', res: any): void;
98
- (e: 'getuserinfo', res: any): void;
99
- (e: 'error', res: any): void;
100
- (e: 'opensetting', res: any): void;
101
- (e: 'launchapp', res: any): void;
102
- }>();
112
+ const emit = defineEmits(['click', 'getuserinfo', 'contact', 'getphonenumber', 'error', 'launchapp', 'opensetting', 'chooseavatar', 'agreeprivacyauthorization']);
113
+
114
+ type ButtonScope = 'phoneNumber' | 'userInfo';
115
+
116
+ type ButtonOpenType =
117
+ | 'feedback'
118
+ | 'share'
119
+ | 'getUserInfo'
120
+ | 'contact'
121
+ | 'getPhoneNumber'
122
+ | 'launchApp'
123
+ | 'openSetting'
124
+ | 'chooseAvatar'
125
+ | 'getAuthorize'
126
+ | 'lifestyle'
127
+ | 'contactShare'
128
+ | 'openGroupProfile'
129
+ | 'openGuildProfile'
130
+ | 'openPublicProfile'
131
+ | 'shareMessageToFriend'
132
+ | 'addFriend'
133
+ | 'addColorSign'
134
+ | 'addGroupApp'
135
+ | 'addToFavorites'
136
+ | 'chooseAddress'
137
+ | 'chooseInvoiceTitle'
138
+ | 'login'
139
+ | 'subscribe'
140
+ | 'favorite'
141
+ | 'watchLater'
142
+ | 'openProfile'
143
+ | 'agreePrivacyAuthorization';
103
144
 
104
145
  const props = defineProps({
105
146
  /** 是否细边框 */
@@ -116,8 +157,10 @@ const props = defineProps({
116
157
  disabled: { type: Boolean, default: false },
117
158
  /** 是否加载中 */
118
159
  loading: { type: Boolean, default: false },
160
+ /** 支付宝小程序,当 open-type 为 getAuthorize 时有效 */
161
+ scope: { type: String as PropType<ButtonScope>, default: '' },
119
162
  /** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
120
- openType: { type: String, default: '' },
163
+ openType: { type: String as PropType<ButtonOpenType>, default: '' },
121
164
  /** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
122
165
  formType: { type: String, default: '' },
123
166
  /** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 */
@@ -278,32 +321,66 @@ function getElQuery(): Promise<any[]> {
278
321
  /**
279
322
  * open-type="getPhoneNumber"时有效
280
323
  */
281
- function getphonenumber(res: any) {
282
- emit('getphonenumber', res);
324
+ function getphonenumber(event: any) {
325
+ emit('getphonenumber', event);
283
326
  }
284
327
  /**
285
328
  * 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
286
329
  */
287
- function getuserinfo(res: any) {
288
- emit('getuserinfo', res);
330
+ function getuserinfo(event: any) {
331
+ emit('getuserinfo', event);
289
332
  }
290
333
  /**
291
334
  * 当使用开放能力时,发生错误的回调
292
335
  */
293
- function error(res: any) {
294
- emit('error', res);
336
+ function error(event: any) {
337
+ emit('error', event);
295
338
  }
296
339
  /**
297
340
  * 在打开授权设置页并关闭后回调
298
341
  */
299
- function opensetting(res: any) {
300
- emit('opensetting', res);
342
+ function opensetting(event: any) {
343
+ emit('opensetting', event);
301
344
  }
302
345
  /**
303
346
  * 打开 APP 成功的回调
304
347
  */
305
- function launchapp(res: any) {
306
- emit('launchapp', res);
348
+ function launchapp(event: any) {
349
+ emit('launchapp', event);
350
+ }
351
+
352
+ /**
353
+ * 支付宝小程序授权
354
+ * @param event
355
+ */
356
+ function getAuthorize(event: any) {
357
+ if (props.scope === 'phoneNumber') {
358
+ getphonenumber(event);
359
+ } else if (props.scope === 'userInfo') {
360
+ getuserinfo(event);
361
+ }
362
+ }
363
+
364
+ /**
365
+ * 客服消息回调
366
+ * @param event
367
+ */
368
+ function contact(event: any) {
369
+ emit('contact', event);
370
+ }
371
+ /**
372
+ * 头像选择回调
373
+ * @param event
374
+ */
375
+ function chooseavatar(event: any) {
376
+ emit('chooseavatar', event);
377
+ }
378
+ /**
379
+ * 用户点击允许授权回调
380
+ * @param event
381
+ */
382
+ function agreeprivacyauthorization(event: any) {
383
+ emit('agreeprivacyauthorization', event);
307
384
  }
308
385
  </script>
309
386
 
@@ -0,0 +1,244 @@
1
+ <template>
2
+ <u-popup
3
+ v-model="popupValue"
4
+ mode="bottom"
5
+ :popup="false"
6
+ :mask="true"
7
+ :closeable="true"
8
+ :safe-area-inset-bottom="true"
9
+ close-icon-color="#ffffff"
10
+ :z-index="uZIndex"
11
+ :maskCloseAble="props.maskCloseAble"
12
+ @close="close"
13
+ >
14
+ <u-tabs v-if="popupValue" :list="genTabsList" :is-scroll="true" :current="tabsIndex" @change="tabsChange" ref="tabs"></u-tabs>
15
+ <view class="area-box">
16
+ <view class="u-flex" :class="{ change: isChange }">
17
+ <!-- 省 -->
18
+ <view class="area-item">
19
+ <view class="u-padding-10 u-bg-gray" style="height: 100%">
20
+ <scroll-view :scroll-y="true" style="height: 100%">
21
+ <u-cell-group>
22
+ <u-cell-item v-for="(item, index) in provincesList" :title="item.label" :arrow="false" :index="index" :key="index" @click="provinceChange(index)">
23
+ <template v-if="isChooseP && province === index" #right-icon>
24
+ <u-icon size="34" name="checkbox-mark"></u-icon>
25
+ </template>
26
+ </u-cell-item>
27
+ </u-cell-group>
28
+ </scroll-view>
29
+ </view>
30
+ </view>
31
+ <!-- 市 -->
32
+ <view class="area-item">
33
+ <view class="u-padding-10 u-bg-gray" style="height: 100%">
34
+ <scroll-view :scroll-y="true" style="height: 100%">
35
+ <u-cell-group v-if="isChooseP">
36
+ <u-cell-item v-for="(item, index) in citys" :title="item.label" :arrow="false" :index="index" :key="index" @click="cityChange(index)">
37
+ <template v-if="isChooseC && city === index" #right-icon>
38
+ <u-icon size="34" name="checkbox-mark"></u-icon>
39
+ </template>
40
+ </u-cell-item>
41
+ </u-cell-group>
42
+ </scroll-view>
43
+ </view>
44
+ </view>
45
+ <!-- 区 -->
46
+ <view class="area-item">
47
+ <view class="u-padding-10 u-bg-gray" style="height: 100%">
48
+ <scroll-view :scroll-y="true" style="height: 100%">
49
+ <u-cell-group v-if="isChooseC">
50
+ <u-cell-item v-for="(item, index) in areas" :title="item.label" :arrow="false" :index="index" :key="index" @click="areaChange(index)">
51
+ <template v-if="isChooseA && area === index" #right-icon>
52
+ <u-icon size="34" name="checkbox-mark"></u-icon>
53
+ </template>
54
+ </u-cell-item>
55
+ </u-cell-group>
56
+ </scroll-view>
57
+ </view>
58
+ </view>
59
+ </view>
60
+ </view>
61
+ </u-popup>
62
+ </template>
63
+
64
+ <script setup lang="ts">
65
+ import { ref, computed, onMounted } from 'vue';
66
+ import provinces from '../../libs/util/province';
67
+ import citysData from '../../libs/util/city';
68
+ import areasData from '../../libs/util/area';
69
+ import type { PropType } from 'vue';
70
+
71
+ defineOptions({
72
+ name: 'u-city-select'
73
+ });
74
+
75
+ /**
76
+ * u-city-select 城市选择器
77
+ * @description 用于选择省、市、区三级行政区域,支持回显和自定义初始值。
78
+ * @property {Boolean} modelValue 控制弹窗显示与隐藏(v-model)
79
+ * @property {Array} defaultRegion 默认选中的省市区名称数组,如 ['广东省', '广州市', '天河区']
80
+ * @property {Array} areaCode 默认选中的省市区编码数组,如 ['440000', '440100', '440106']
81
+ * @property {Boolean} maskCloseAble 是否允许点击遮罩关闭弹窗(默认 true)
82
+ * @property {String|Number} zIndex 弹窗层级(默认 0,自动适配)
83
+ * @event update:modelValue v-model 绑定值变化时触发
84
+ * @event city-change 选择省市区后触发,返回选中的省市区对象
85
+ * @example <u-city-select v-model="show" :defaultRegion="['广东省','广州市','天河区']" @city-change="onChange"></u-city-select>
86
+ */
87
+
88
+ // props 定义
89
+ const props = defineProps({
90
+ modelValue: { type: Boolean, default: false },
91
+ defaultRegion: { type: Array as PropType<string[]>, default: () => [] },
92
+ areaCode: { type: Array as PropType<string[]>, default: () => [] },
93
+ maskCloseAble: { type: Boolean, default: true },
94
+ zIndex: { type: [String, Number], default: 0 }
95
+ });
96
+
97
+ // emits 定义
98
+ const emit = defineEmits(['update:modelValue', 'city-change']);
99
+
100
+ // 省市区选择相关响应式数据
101
+ const cityValue = ref('');
102
+ const isChooseP = ref(false); // 是否已选省
103
+ const province = ref(0); // 省下标
104
+ const provincesList = ref(provinces);
105
+ const isChooseC = ref(false); // 是否已选市
106
+ const city = ref(0); // 市下标
107
+ const citys = ref(citysData[0]);
108
+ const isChooseA = ref(false); // 是否已选区
109
+ const area = ref(0); // 区下标
110
+ const areas = ref(areasData[0][0]);
111
+ const tabsIndex = ref(0);
112
+
113
+ // v-model 双向绑定
114
+ const popupValue = computed({
115
+ get: () => props.modelValue,
116
+ set: val => emit('update:modelValue', val)
117
+ });
118
+
119
+ // 是否切换到区级
120
+ const isChange = computed(() => tabsIndex.value > 1);
121
+
122
+ // 顶部 tab 列表
123
+ const genTabsList = computed(() => {
124
+ const tabsList = [{ name: '请选择' }];
125
+ if (isChooseP.value) {
126
+ tabsList[0].name = provincesList.value[province.value].label;
127
+ tabsList[1] = { name: '请选择' };
128
+ }
129
+ if (isChooseC.value) {
130
+ tabsList[1].name = citys.value[city.value].label;
131
+ tabsList[2] = { name: '请选择' };
132
+ }
133
+ if (isChooseA.value) {
134
+ tabsList[2].name = areas.value[area.value].label;
135
+ }
136
+ return tabsList;
137
+ });
138
+
139
+ // z-index 计算
140
+ const uZIndex = computed(() => (props.zIndex ? props.zIndex : (uni as any).$u?.zIndex?.popup || 1075));
141
+
142
+ // 初始化选中项
143
+ function init() {
144
+ if (props.areaCode.length === 3) {
145
+ setProvince('', props.areaCode[0]);
146
+ setCity('', props.areaCode[1]);
147
+ setArea('', props.areaCode[2]);
148
+ } else if (props.defaultRegion.length === 3) {
149
+ setProvince(props.defaultRegion[0], '');
150
+ setCity(props.defaultRegion[1], '');
151
+ setArea(props.defaultRegion[2], '');
152
+ }
153
+ }
154
+
155
+ // 选中省
156
+ function setProvince(label = '', value = '') {
157
+ provincesList.value.forEach((v, k) => {
158
+ if (value ? v.value == value : v.label == label) {
159
+ provinceChange(k);
160
+ }
161
+ });
162
+ }
163
+ // 选中市
164
+ function setCity(label = '', value = '') {
165
+ citys.value.forEach((v, k) => {
166
+ if (value ? v.value == value : v.label == label) {
167
+ cityChange(k);
168
+ }
169
+ });
170
+ }
171
+ // 选中区
172
+ function setArea(label = '', value = '') {
173
+ areas.value.forEach((v, k) => {
174
+ if (value ? v.value == value : v.label == label) {
175
+ isChooseA.value = true;
176
+ area.value = k;
177
+ }
178
+ });
179
+ }
180
+
181
+ // 关闭弹窗
182
+ function close() {
183
+ emit('update:modelValue', false);
184
+ }
185
+ // tab 切换
186
+ function tabsChange(index: number) {
187
+ tabsIndex.value = index;
188
+ }
189
+ // 省点击
190
+ function provinceChange(index: number) {
191
+ isChooseP.value = true;
192
+ isChooseC.value = false;
193
+ isChooseA.value = false;
194
+ province.value = index;
195
+ citys.value = citysData[index];
196
+ tabsIndex.value = 1;
197
+ }
198
+ // 市点击
199
+ function cityChange(index: number) {
200
+ isChooseC.value = true;
201
+ isChooseA.value = false;
202
+ city.value = index;
203
+ areas.value = areasData[province.value][index];
204
+ tabsIndex.value = 2;
205
+ }
206
+ // 区点击
207
+ function areaChange(index: number) {
208
+ isChooseA.value = true;
209
+ area.value = index;
210
+ const result = {
211
+ province: provincesList.value[province.value],
212
+ city: citys.value[city.value],
213
+ area: areas.value[area.value]
214
+ };
215
+ emit('city-change', result);
216
+ close();
217
+ }
218
+
219
+ // 挂载时初始化
220
+ onMounted(init);
221
+ </script>
222
+
223
+ <style lang="scss">
224
+ .area-box {
225
+ width: 100%;
226
+ overflow: hidden;
227
+ height: 800rpx;
228
+
229
+ > view {
230
+ width: 150%;
231
+ transition: transform 0.3s ease-in-out 0s;
232
+ transform: translateX(0);
233
+
234
+ &.change {
235
+ transform: translateX(-33.3333333%);
236
+ }
237
+ }
238
+
239
+ .area-item {
240
+ width: 33.3333333%;
241
+ height: 800rpx;
242
+ }
243
+ }
244
+ </style>
@@ -187,6 +187,7 @@ const vertical = computed(() => {
187
187
  const computeBgColor = computed(() => {
188
188
  if (props.bgColor) return props.bgColor;
189
189
  else if (props.type === 'none') return 'transparent';
190
+ else return '';
190
191
  });
191
192
 
192
193
  /**
@@ -223,6 +224,7 @@ function change(e: { detail: { current: number } }) {
223
224
 
224
225
  <style lang="scss" scoped>
225
226
  @import '../../libs/css/style.components.scss';
227
+
226
228
  .u-notice-bar {
227
229
  width: 100%;
228
230
  @include vue-flex;
@@ -232,6 +234,7 @@ function change(e: { detail: { current: number } }) {
232
234
  padding: 18rpx 24rpx;
233
235
  overflow: hidden;
234
236
  }
237
+
235
238
  .u-swiper {
236
239
  font-size: 26rpx;
237
240
  height: 32rpx;
@@ -240,14 +243,17 @@ function change(e: { detail: { current: number } }) {
240
243
  flex: 1;
241
244
  margin-left: 12rpx;
242
245
  }
246
+
243
247
  .u-swiper-item {
244
248
  @include vue-flex;
245
249
  align-items: center;
246
250
  overflow: hidden;
247
251
  }
252
+
248
253
  .u-news-item {
249
254
  overflow: hidden;
250
255
  }
256
+
251
257
  .u-right-icon {
252
258
  margin-left: 12rpx;
253
259
  /* #ifndef APP-NVUE */
@@ -255,6 +261,7 @@ function change(e: { detail: { current: number } }) {
255
261
  /* #endif */
256
262
  align-items: center;
257
263
  }
264
+
258
265
  .u-left-icon {
259
266
  /* #ifndef APP-NVUE */
260
267
  display: inline-flex;
@@ -111,31 +111,31 @@ const props = defineProps({
111
111
  * @default '#606266'
112
112
  */
113
113
  labelColor: { type: String, default: '#606266' },
114
- /**
115
- * label与图标的距离(横向排列),单位rpx(默认6)
116
- * @default '6'
117
- */
118
- marginLeft: { type: [String, Number], default: '6' },
119
- /**
120
- * label与图标的距离(竖向排列),单位rpx(默认6)
121
- * @default '6'
122
- */
123
- marginTop: { type: [String, Number], default: '6' },
124
- /**
125
- * label与图标的距离(竖向排列),单位rpx(默认6)
126
- * @default '6'
127
- */
128
- marginRight: { type: [String, Number], default: '6' },
129
- /**
130
- * label与图标的距离(竖向排列),单位rpx(默认6)
131
- * @default '6'
132
- */
133
- marginBottom: { type: [String, Number], default: '6' },
114
+ /**
115
+ * label与图标的距离(横向排列),单位rpx(默认6)
116
+ * @default '6'
117
+ */
118
+ marginLeft: { type: [String, Number], default: '6' },
119
+ /**
120
+ * label与图标的距离(竖向排列),单位rpx(默认6)
121
+ * @default '6'
122
+ */
123
+ marginTop: { type: [String, Number], default: '6' },
124
+ /**
125
+ * label与图标的距离(竖向排列),单位rpx(默认6)
126
+ * @default '6'
127
+ */
128
+ marginRight: { type: [String, Number], default: '6' },
129
+ /**
130
+ * label与图标的距离(竖向排列),单位rpx(默认6)
131
+ * @default '6'
132
+ */
133
+ marginBottom: { type: [String, Number], default: '6' },
134
134
  /**
135
135
  * label与图标的距离,单位rpx,权重高于 margin
136
136
  * @default ''
137
137
  */
138
- space: { type: [String, Number], default: '' },
138
+ space: { type: [String, Number], default: '' },
139
139
  /**
140
140
  * 图片的mode,参考uni-app image组件
141
141
  * @default 'widthFix'
@@ -78,6 +78,8 @@ const numList = computed(() => {
78
78
  return $u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, cardX, 0]);
79
79
  }
80
80
  }
81
+ // 默认返回数字键盘
82
+ return [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
81
83
  });
82
84
 
83
85
  /**
@@ -2,9 +2,9 @@
2
2
  <view class="u-rate" :id="elId" @touchmove.stop.prevent="touchMove">
3
3
  <view class="u-star-wrap" v-for="(item, index) in count" :key="index" :class="[elClass]">
4
4
  <u-icon
5
- :name="activeIndex > index ? elActiveIcon : inactiveIcon"
5
+ :name="String(activeIndex > index ? elActiveIcon : inactiveIcon)"
6
6
  @click="click(index + 1, $event)"
7
- :color="activeIndex > index ? elActiveColor : inactiveColor"
7
+ :color="String(activeIndex > index ? elActiveColor : inactiveColor)"
8
8
  :custom-style="{
9
9
  fontSize: size + 'rpx',
10
10
  padding: `0 ${Number(gutter) / 2 + 'rpx'}`
@@ -197,10 +197,17 @@ watch(
197
197
  /**
198
198
  * 计算当前星星的显示小数部分(半星)
199
199
  */
200
- const decimal = computed(() => {
200
+ const decimal = computed((): number => {
201
201
  if (props.disabled) {
202
- return (Number(activeIndex.value) * 100) % 100;
202
+ // 只在允许半星时才返回小数部分,否则始终为0
203
+ if (props.allowHalf) {
204
+ // 计算当前激活星星的小数部分(如3.5星,返回50)
205
+ const val = Number(activeIndex.value);
206
+ return (val - Math.floor(val)) * 100;
207
+ }
208
+ return 0;
203
209
  } else if (props.allowHalf) {
210
+ // 允许半星时,返回50,否则0
204
211
  return 50;
205
212
  }
206
213
  return 0;
@@ -147,6 +147,7 @@ const textStyle = computed(() => {
147
147
  const computeBgColor = computed(() => {
148
148
  if (props.bgColor) return props.bgColor;
149
149
  else if (props.type === 'none') return 'transparent';
150
+ else return '';
150
151
  });
151
152
 
152
153
  /**
@@ -223,32 +224,38 @@ function getMore() {
223
224
 
224
225
  <style lang="scss" scoped>
225
226
  @import '../../libs/css/style.components.scss';
227
+
226
228
  .u-notice-bar {
227
229
  padding: 18rpx 24rpx;
228
230
  overflow: hidden;
229
231
  }
232
+
230
233
  .u-direction-row {
231
234
  @include vue-flex;
232
235
  align-items: center;
233
236
  justify-content: space-between;
234
237
  }
238
+
235
239
  .u-left-icon {
236
240
  /* #ifndef APP-NVUE */
237
241
  display: inline-flex;
238
242
  /* #endif */
239
243
  align-items: center;
240
244
  }
245
+
241
246
  .u-notice-box {
242
247
  flex: 1;
243
248
  @include vue-flex;
244
249
  overflow: hidden;
245
250
  margin-left: 12rpx;
246
251
  }
252
+
247
253
  .u-right-icon {
248
254
  margin-left: 12rpx;
249
255
  display: inline-flex;
250
256
  align-items: center;
251
257
  }
258
+
252
259
  .u-notice-content {
253
260
  animation: u-loop-animation 10s linear infinite both;
254
261
  text-align: right;
@@ -257,15 +264,18 @@ function getMore() {
257
264
  @include vue-flex;
258
265
  flex-wrap: nowrap;
259
266
  }
267
+
260
268
  .u-notice-text {
261
269
  font-size: 26rpx;
262
270
  word-break: keep-all;
263
271
  white-space: nowrap;
264
272
  }
273
+
265
274
  @keyframes u-loop-animation {
266
275
  0% {
267
276
  transform: translate3d(0, 0, 0);
268
277
  }
278
+
269
279
  100% {
270
280
  transform: translate3d(-100%, 0, 0);
271
281
  }
@@ -35,7 +35,8 @@
35
35
  ></view>
36
36
  </view>
37
37
  <!-- 这里加上一个48rpx的高度,是为了增高有凸起按钮时的防塌陷高度(也即按钮凸出来部分的高度) -->
38
- <view class="u-fixed-placeholder safe-area-inset-bottom" :style="{ height: `calc(${$u.addUnit(props.height)} + ${props.midButton ? 48 : 0}rpx)` }"></view>
38
+ <!-- calc 计算0时单位不一致会计算失败,这里+1px -->
39
+ <view class="u-fixed-placeholder safe-area-inset-bottom" :style="{ height: `calc(${$u.addUnit(props.height)} + ${props.midButton ? '48rpx' : '1px'})` }"></view>
39
40
  </view>
40
41
  </template>
41
42
 
@@ -261,6 +262,7 @@ function getMidButtonLeft() {
261
262
  /* #ifndef APP-NVUE */
262
263
  box-sizing: content-box;
263
264
  /* #endif */
265
+ height: 50px;
264
266
  }
265
267
  .u-tabbar {
266
268
  &__content {