uview-pro 0.6.4 → 0.6.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.
- package/changelog.md +37 -12
- package/components/u-action-sheet/types.ts +2 -4
- package/components/u-action-sheet/u-action-sheet.vue +7 -2
- package/components/u-calendar/types.ts +4 -6
- package/components/u-calendar/u-calendar.vue +9 -5
- package/components/u-input/types.ts +1 -4
- package/components/u-input/u-input.vue +7 -3
- package/components/u-keyboard/types.ts +2 -5
- package/components/u-keyboard/u-keyboard.vue +6 -2
- package/components/u-link/types.ts +2 -4
- package/components/u-link/u-link.vue +9 -3
- package/components/u-loadmore/types.ts +1 -5
- package/components/u-loadmore/u-loadmore.vue +13 -4
- package/components/u-modal/types.ts +4 -6
- package/components/u-modal/u-modal.vue +20 -3
- package/components/u-no-network/types.ts +1 -4
- package/components/u-no-network/u-no-network.vue +4 -1
- package/components/u-pagination/types.ts +2 -5
- package/components/u-pagination/u-pagination.vue +9 -3
- package/components/u-picker/types.ts +3 -5
- package/components/u-picker/u-picker.vue +9 -3
- package/components/u-read-more/types.ts +3 -5
- package/components/u-read-more/u-read-more.vue +7 -2
- package/components/u-search/types.ts +65 -68
- package/components/u-search/u-search.vue +296 -291
- package/components/u-section/types.ts +1 -4
- package/components/u-section/u-section.vue +7 -2
- package/components/u-select/types.ts +3 -5
- package/components/u-select/u-select.vue +9 -4
- package/components/u-upload/types.ts +1 -4
- package/components/u-upload/u-upload.vue +1 -1
- package/components/u-verification-code/types.ts +3 -6
- package/components/u-verification-code/u-verification-code.vue +16 -9
- package/locale/lang/en-US.ts +1 -1
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
:hover-stay-time="150"
|
|
29
29
|
@tap="getResult('cancel')"
|
|
30
30
|
>
|
|
31
|
-
{{
|
|
31
|
+
{{ getCancelText }}
|
|
32
32
|
</view>
|
|
33
33
|
<view class="u-select__header__title u-line-1"> {{ title }}</view>
|
|
34
34
|
<view
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
@touchmove.stop=""
|
|
40
40
|
@tap.stop="getResult('confirm')"
|
|
41
41
|
>
|
|
42
|
-
{{
|
|
42
|
+
{{ getConfirmText }}
|
|
43
43
|
</view>
|
|
44
44
|
</view>
|
|
45
45
|
<view class="u-select__body">
|
|
@@ -86,7 +86,7 @@ export default {
|
|
|
86
86
|
import { ref, computed, watch, nextTick } from 'vue';
|
|
87
87
|
import { SelectProps } from './types';
|
|
88
88
|
import type { SelectListItem } from '../../types/global';
|
|
89
|
-
import { $u } from '../..';
|
|
89
|
+
import { $u, useLocale } from '../..';
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* select 列选择器
|
|
@@ -112,8 +112,9 @@ import { $u } from '../..';
|
|
|
112
112
|
|
|
113
113
|
const props = defineProps(SelectProps);
|
|
114
114
|
const emit = defineEmits(['update:modelValue', 'confirm', 'cancel', 'click']);
|
|
115
|
-
|
|
115
|
+
const { t } = useLocale();
|
|
116
116
|
|
|
117
|
+
// 用于列改变时,保存当前的索引,下一次变化时比较得出是哪一列发生了变化
|
|
117
118
|
const defaultSelector = ref<number[]>([0]);
|
|
118
119
|
// picker-view的数据
|
|
119
120
|
const columnData = ref<SelectListItem[][]>([]);
|
|
@@ -139,6 +140,10 @@ const popupValue = computed({
|
|
|
139
140
|
set: (val: boolean) => emit('update:modelValue', val)
|
|
140
141
|
});
|
|
141
142
|
|
|
143
|
+
// 国际化计算属性
|
|
144
|
+
const getCancelText = computed(() => props.cancelText || t('uSelect.cancelText'));
|
|
145
|
+
const getConfirmText = computed(() => props.confirmText || t('uSelect.confirmText'));
|
|
146
|
+
|
|
142
147
|
watch(
|
|
143
148
|
() => props.modelValue,
|
|
144
149
|
async val => {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { ImgMode, UploadSizeType, UploadSourceType, UploadAcceptType, UploadFileItem } from '../../types/global';
|
|
3
|
-
import { useLocale } from '../../';
|
|
4
|
-
|
|
5
|
-
const { t } = useLocale();
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* UploadProps upload props 类型定义
|
|
@@ -48,7 +45,7 @@ export const UploadProps = {
|
|
|
48
45
|
/** 是否自定义上传按钮 */
|
|
49
46
|
customBtn: { type: Boolean, default: false },
|
|
50
47
|
/** 上传按钮文字 */
|
|
51
|
-
uploadText: { type: String, default:
|
|
48
|
+
uploadText: { type: String, default: '' },
|
|
52
49
|
/** 上传地址 */
|
|
53
50
|
action: { type: String, default: '' },
|
|
54
51
|
/** 是否禁用 */
|
|
@@ -400,7 +400,7 @@ const extTypeMap: Record<string, string> = {
|
|
|
400
400
|
*/
|
|
401
401
|
const uploadBtnText = computed(() => {
|
|
402
402
|
// 如果用户自定义了 uploadText,优先使用
|
|
403
|
-
if (props.uploadText
|
|
403
|
+
if (props.uploadText) {
|
|
404
404
|
return props.uploadText;
|
|
405
405
|
}
|
|
406
406
|
// 根据 accept 类型返回对应的国际化文本
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { useLocale } from '../../';
|
|
3
|
-
|
|
4
|
-
const { t } = useLocale();
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
4
|
* VerificationCodeProps 验证码输入框 props 类型定义
|
|
@@ -21,11 +18,11 @@ export const VerificationCodeProps = {
|
|
|
21
18
|
/** 倒计时时长,单位秒 */
|
|
22
19
|
seconds: { type: [String, Number] as PropType<string | number>, default: 60 },
|
|
23
20
|
/** 开始时按钮文字 */
|
|
24
|
-
startText: { type: String, default:
|
|
21
|
+
startText: { type: String, default: '' },
|
|
25
22
|
/** 倒计时进行中按钮文字,X为剩余秒数 */
|
|
26
|
-
changeText: { type: String, default:
|
|
23
|
+
changeText: { type: String, default: '' },
|
|
27
24
|
/** 结束时按钮文字 */
|
|
28
|
-
endText: { type: String, default:
|
|
25
|
+
endText: { type: String, default: '' },
|
|
29
26
|
/** 是否保持倒计时不中断(如页面切换) */
|
|
30
27
|
keepRunning: { type: Boolean, default: false },
|
|
31
28
|
/** 唯一标识key,用于区分多个验证码组件 */
|
|
@@ -18,9 +18,9 @@ export default {
|
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
|
-
import { ref, watch, onMounted, onBeforeUnmount } from 'vue';
|
|
21
|
+
import { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue';
|
|
22
22
|
import { VerificationCodeProps } from './types';
|
|
23
|
-
import { $u } from '../../';
|
|
23
|
+
import { $u, useLocale } from '../../';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* verificationCode 验证码输入框
|
|
@@ -38,9 +38,16 @@ import { $u } from '../../';
|
|
|
38
38
|
* @example <u-verification-code :seconds="seconds" @end="end" @start="start" ref="uCode" />
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
+
const props = defineProps(VerificationCodeProps);
|
|
42
|
+
|
|
41
43
|
const emit = defineEmits(['change', 'start', 'end']);
|
|
42
44
|
|
|
43
|
-
const
|
|
45
|
+
const { t } = useLocale();
|
|
46
|
+
|
|
47
|
+
// 国际化计算属性
|
|
48
|
+
const getStartText = computed(() => props.startText || t('uVerificationCode.startText'));
|
|
49
|
+
const getChangeText = computed(() => props.changeText || t('uVerificationCode.changeText'));
|
|
50
|
+
const getEndText = computed(() => props.endText || t('uVerificationCode.endText'));
|
|
44
51
|
|
|
45
52
|
/** 当前倒计时秒数 */
|
|
46
53
|
const secNum = ref(Number(props.seconds));
|
|
@@ -75,7 +82,7 @@ onBeforeUnmount(() => {
|
|
|
75
82
|
function checkKeepRunning() {
|
|
76
83
|
// 获取上一次退出页面(H5还包括刷新)时的时间戳,如果没有上次的保存,此值可能为空
|
|
77
84
|
const lastTimestamp = Number(uni.getStorageSync(props.uniqueKey + '_$uCountDownTimestamp'));
|
|
78
|
-
if (!lastTimestamp) return changeEvent(
|
|
85
|
+
if (!lastTimestamp) return changeEvent(getStartText.value);
|
|
79
86
|
// 当前秒的时间戳
|
|
80
87
|
const nowTimestamp = Math.floor(+new Date() / 1000);
|
|
81
88
|
// 判断当前的时间戳,是否小于上一次的本该按设定结束,却提前结束的时间戳
|
|
@@ -88,7 +95,7 @@ function checkKeepRunning() {
|
|
|
88
95
|
start();
|
|
89
96
|
} else {
|
|
90
97
|
// 如果不存在需要继续上一次的倒计时,执行正常的逻辑
|
|
91
|
-
changeEvent(
|
|
98
|
+
changeEvent(getStartText.value);
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
|
|
@@ -104,16 +111,16 @@ function start() {
|
|
|
104
111
|
emit('start');
|
|
105
112
|
canGetCode.value = false;
|
|
106
113
|
// 一开始时就提示,否则要等setInterval的1秒后才会有提示
|
|
107
|
-
changeEvent(
|
|
114
|
+
changeEvent(getChangeText.value.replace(/x|X/, String(secNum.value)));
|
|
108
115
|
setTimeToStorage();
|
|
109
116
|
timer = setInterval(() => {
|
|
110
117
|
if (--secNum.value) {
|
|
111
118
|
// 用当前倒计时的秒数替换提示字符串中的"x"字母
|
|
112
|
-
changeEvent(
|
|
119
|
+
changeEvent(getChangeText.value.replace(/x|X/, String(secNum.value)));
|
|
113
120
|
} else {
|
|
114
121
|
clearInterval(timer!);
|
|
115
122
|
timer = null;
|
|
116
|
-
changeEvent(
|
|
123
|
+
changeEvent(getEndText.value);
|
|
117
124
|
secNum.value = Number(props.seconds);
|
|
118
125
|
emit('end');
|
|
119
126
|
canGetCode.value = true;
|
|
@@ -129,7 +136,7 @@ function reset() {
|
|
|
129
136
|
if (timer) clearInterval(timer);
|
|
130
137
|
timer = null;
|
|
131
138
|
secNum.value = Number(props.seconds);
|
|
132
|
-
changeEvent(
|
|
139
|
+
changeEvent(getEndText.value);
|
|
133
140
|
}
|
|
134
141
|
|
|
135
142
|
/**
|
package/locale/lang/en-US.ts
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "uview-pro",
|
|
3
3
|
"name": "uview-pro",
|
|
4
4
|
"displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的高质量UI组件库,支持多主题、暗黑模式、多语言",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.6",
|
|
6
6
|
"description": "uView Pro是基于Vue3+TS的多平台UI框架,提供80+高质量组件、便捷工具和常用模板,支持多主题、暗黑模式、多语言,支持H5/APP/鸿蒙/小程序多端开发。已在鸿蒙应用商店上架,欢迎体验!",
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"module": "index.ts",
|