uview-pro 0.5.3 → 0.5.5
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 +47 -10
- package/components/u-action-sheet/types.ts +1 -1
- package/components/u-action-sheet/u-action-sheet.vue +5 -5
- package/components/u-action-sheet-item/types.ts +1 -1
- package/components/u-alert-tips/types.ts +1 -1
- package/components/u-alert-tips/u-alert-tips.vue +1 -1
- package/components/u-avatar/types.ts +1 -1
- package/components/u-avatar-cropper/types.ts +1 -1
- package/components/u-back-top/types.ts +1 -1
- package/components/u-badge/types.ts +1 -1
- package/components/u-button/u-button.vue +4 -3
- package/components/u-calendar/types.ts +1 -1
- package/components/u-calendar/u-calendar.vue +1 -1
- package/components/u-car-keyboard/types.ts +1 -1
- package/components/u-card/types.ts +1 -1
- package/components/u-cell-group/types.ts +1 -1
- package/components/u-cell-item/types.ts +1 -1
- package/components/u-checkbox/types.ts +1 -1
- package/components/u-checkbox-group/types.ts +1 -1
- package/components/u-circle-progress/types.ts +1 -1
- package/components/u-circle-progress/u-circle-progress.vue +1 -1
- package/components/u-dropdown-item/u-dropdown-item.vue +1 -1
- package/components/u-empty/u-empty.vue +1 -1
- package/components/u-fab/u-fab.vue +1 -1
- package/components/u-field/types.ts +9 -9
- package/components/u-field/u-field.vue +8 -7
- package/components/u-form-item/u-form-item.vue +1 -1
- package/components/u-image/types.ts +1 -1
- package/components/u-index-anchor/u-index-anchor.vue +5 -5
- package/components/u-input/u-input.vue +8 -7
- package/components/u-loading/types.ts +2 -0
- package/components/u-loading/u-loading.vue +3 -2
- package/components/u-loadmore/types.ts +2 -0
- package/components/u-loadmore/u-loadmore.vue +11 -8
- package/components/u-message-input/u-message-input.vue +4 -3
- package/components/u-modal/service.ts +29 -0
- package/components/u-modal/types.ts +11 -1
- package/components/u-modal/u-modal.vue +198 -32
- package/components/u-navbar/u-navbar.vue +4 -4
- package/components/u-notice-bar/u-notice-bar.vue +1 -1
- package/components/u-pagination/u-pagination.vue +1 -1
- package/components/u-popup/u-popup.vue +2 -2
- package/components/u-rate/u-rate.vue +4 -4
- package/components/u-safe-bottom/u-safe-bottom.vue +4 -1
- package/components/u-search/u-search.vue +1 -1
- package/components/u-section/types.ts +1 -1
- package/components/u-switch/u-switch.vue +1 -1
- package/components/u-tabbar/types.ts +4 -1
- package/components/u-tabbar/u-tabbar.vue +4 -4
- package/components/u-text/u-text.vue +17 -16
- package/components/u-textarea/types.ts +1 -1
- package/components/u-textarea/u-textarea.vue +5 -4
- package/components/u-toast/service.ts +21 -0
- package/components/u-toast/types.ts +10 -3
- package/components/u-toast/u-toast.vue +103 -28
- package/components/u-upload/types.ts +2 -2
- package/components/u-upload/u-upload.vue +1 -1
- package/index.ts +1 -1
- package/libs/function/clipboard.ts +5 -5
- package/libs/function/color.ts +3 -1
- package/libs/function/styleUtils.ts +5 -5
- package/libs/function/test.ts +6 -6
- package/libs/function/type2icon.ts +3 -4
- package/libs/hooks/index.ts +2 -0
- package/libs/hooks/useCompRelation.ts +4 -4
- package/libs/hooks/useModal.ts +105 -0
- package/libs/hooks/useRect.ts +9 -4
- package/libs/hooks/useToast.ts +93 -0
- package/libs/index.ts +1 -1
- package/libs/request/index.ts +4 -4
- package/locale/lang/en-US.ts +2 -0
- package/locale/lang/zh-CN.ts +2 -0
- package/package.json +1 -1
- package/types/global.d.ts +1 -1
package/changelog.md
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
|
-
## 0.5.
|
|
1
|
+
## 0.5.5(2026-02-02)
|
|
2
2
|
|
|
3
|
-
###
|
|
4
|
-
|
|
5
|
-
- **demo-page:** 移除标签栏外层sticky组件 ([ed49275](https://github.com/anyup/uView-Pro/commit/ed49275bc2962426dc4f9185b4b35f6a994cf383))
|
|
3
|
+
### ✨ Features | 新功能
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
- **u-toast:** 新增页面级toast功能并优化loading逻辑 ([4eae5b7](https://github.com/anyup/uView-Pro/commit/4eae5b7ef5d4494c4619bee383e62490994b4317))
|
|
6
|
+
- **useModal:** 新增useModal函数式调用API和全局modal功能(#101) ([724edf3](https://github.com/anyup/uView-Pro/commit/724edf3cd69607a6d4e33954f8d2d701f9502ff3))
|
|
7
|
+
- **locale:** 新增语言配置的标签字段label和区域设置字段locale ([49ba6cb](https://github.com/anyup/uView-Pro/commit/49ba6cbea6b53712496e465dd40654af7608a02d))
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### 🐛 Bug Fixes | Bug 修复
|
|
9
|
+
### ♻️ Code Refactoring | 代码重构
|
|
12
10
|
|
|
13
|
-
- **
|
|
14
|
-
- **u-picker:** 修复u-picker/u-select选择器在亮色/暗黑模式下背景色显示问题 ([072a6cc](https://github.com/anyup/uView-Pro/commit/072a6cc1095b5f17b0c15c3cd2a3d6a75d8a9f08))
|
|
11
|
+
- **demo:** 调整demo演示中吸顶组件默认偏移量为200 ([165da80](https://github.com/anyup/uView-Pro/commit/165da80eb9eec54cf1a5fa8511d82e2b3d11fed1))
|
|
15
12
|
|
|
16
13
|
### 👥 Contributors
|
|
17
14
|
|
|
18
15
|
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
19
16
|
|
|
17
|
+
## 0.5.4(2026-01-30)
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
20
|
+
|
|
21
|
+
- **types:** 优化组件库类型定义和代码健壮性 ([e83eac8](https://github.com/anyup/uView-Pro/commit/e83eac8192476dea5e2d4e5b8b3c68b7da992673))
|
|
22
|
+
- **u-navbar:** 修复状态栏高度获取的条件判断,区分鸿蒙、微信小程序和其他 ([b13d112](https://github.com/anyup/uView-Pro/commit/b13d112be80c46f62bfa343a089f2de70a00f774))
|
|
23
|
+
|
|
24
|
+
### ✨ Features | 新功能
|
|
25
|
+
|
|
26
|
+
- **u-loading:** 增强u-loading的自定义样式功能 ([c9151ce](https://github.com/anyup/uView-Pro/commit/c9151ce4bee44c762bd7970ab280184c730e97b1))
|
|
27
|
+
- **u-toast:** 新增函数式调用API和全局toast功能(#101) ([b8c8fbf](https://github.com/anyup/uView-Pro/commit/b8c8fbff70c14fe0a6106794a638e450cecbeddf))
|
|
28
|
+
- **components:** 优化组件类型安全 ([02b638f](https://github.com/anyup/uView-Pro/commit/02b638f6e251c9b52e5e3ebb1e40d644d895308a))
|
|
29
|
+
|
|
30
|
+
### ♻️ Code Refactoring | 代码重构
|
|
31
|
+
|
|
32
|
+
- **demo:** 移除多余的toast引用 ([67b2677](https://github.com/anyup/uView-Pro/commit/67b26772eb67e9e2b830c95359688b0116395452))
|
|
33
|
+
|
|
34
|
+
### 👥 Contributors
|
|
35
|
+
|
|
36
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
37
|
+
|
|
38
|
+
## 0.5.3(2026-01-26)
|
|
39
|
+
|
|
40
|
+
### ♻️ Code Refactoring | 代码重构
|
|
41
|
+
|
|
42
|
+
- **demo-page:** 移除标签栏外层sticky组件 ([ed49275](https://github.com/anyup/uView-Pro/commit/ed49275bc2962426dc4f9185b4b35f6a994cf383))
|
|
43
|
+
|
|
44
|
+
### 👷 Continuous Integration | CI 配置
|
|
45
|
+
|
|
46
|
+
- 添加 npm 包测试脚本 ([78c5524](https://github.com/anyup/uView-Pro/commit/78c5524abbbc368949ec58437361c995f5146234))
|
|
47
|
+
|
|
48
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
49
|
+
|
|
50
|
+
- **locale:** 修复本地运行时locale国际化字段未加载成功的问题 ([10c017a](https://github.com/anyup/uView-Pro/commit/10c017a401232224ca1642274d65f031f74f12f0))
|
|
51
|
+
- **u-picker:** 修复u-picker/u-select选择器在亮色/暗黑模式下背景色显示问题 ([072a6cc](https://github.com/anyup/uView-Pro/commit/072a6cc1095b5f17b0c15c3cd2a3d6a75d8a9f08))
|
|
52
|
+
|
|
53
|
+
### 👥 Contributors
|
|
54
|
+
|
|
55
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
56
|
+
|
|
20
57
|
## 0.5.2(2026-01-23)
|
|
21
58
|
|
|
22
59
|
### ✨ Features | 新功能
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { ActionSheetItem, ActionSheetTips } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
4
|
import { getColor, useLocale } from '../../';
|
|
@@ -95,18 +95,18 @@ const popupValue = computed({
|
|
|
95
95
|
// 顶部提示的样式
|
|
96
96
|
const tipsStyle = computed(() => {
|
|
97
97
|
let style: Record<string, string> = {};
|
|
98
|
-
style.color = props.tips?.color || $u.color.tipsColor;
|
|
99
|
-
style.fontSize = $u.addUnit(props.tips?.fontSize || '26rpx');
|
|
98
|
+
style.color = String(props.tips?.color || $u.color.tipsColor);
|
|
99
|
+
style.fontSize = $u.addUnit(String(props.tips?.fontSize || '26rpx'));
|
|
100
100
|
return style;
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
// 操作项目的样式
|
|
104
104
|
const itemStyle = (index: number) => {
|
|
105
105
|
let style: Record<string, string> = {};
|
|
106
|
-
style.color = props.list[index]?.color || props.color;
|
|
107
|
-
style.fontSize = $u.addUnit(props.list[index]?.fontSize || props.fontSize);
|
|
106
|
+
style.color = String(props.list[index]?.color || props.color);
|
|
107
|
+
style.fontSize = $u.addUnit(String(props.list[index]?.fontSize || props.fontSize));
|
|
108
108
|
// 选项被禁用的样式
|
|
109
|
-
if (props.list[index]?.disabled) style.color = $u.color.lightColor;
|
|
109
|
+
if (props.list[index]?.disabled) style.color = String($u.color.lightColor || '');
|
|
110
110
|
return style;
|
|
111
111
|
};
|
|
112
112
|
|
|
@@ -118,7 +118,7 @@ const uTitleStyle = computed(() => {
|
|
|
118
118
|
*/
|
|
119
119
|
const uIconName = computed(() => {
|
|
120
120
|
// 如果有设置icon名称就使用,否则根据type主题,推定一个默认的图标
|
|
121
|
-
return props.icon ? props.icon : $u.type2icon(props.type);
|
|
121
|
+
return props.icon ? props.icon : $u.type2icon(props.type as any);
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<!-- prettier-ignore -->
|
|
2
3
|
<button
|
|
3
4
|
id="u-wave-btn"
|
|
4
5
|
class="u-btn u-line-1 u-fix-ios-appearance"
|
|
@@ -15,13 +16,13 @@
|
|
|
15
16
|
:hover-start-time="Number(hoverStartTime)"
|
|
16
17
|
:hover-stay-time="Number(hoverStayTime)"
|
|
17
18
|
:disabled="disabled"
|
|
18
|
-
:form-type="formType"
|
|
19
|
+
:form-type="(formType as any)"
|
|
19
20
|
:open-type="disabled || loading ? undefined : openType"
|
|
20
21
|
:app-parameter="appParameter"
|
|
21
22
|
:hover-stop-propagation="hoverStopPropagation"
|
|
22
23
|
:send-message-title="sendMessageTitle"
|
|
23
|
-
send-message-path="sendMessagePath"
|
|
24
|
-
:lang="lang"
|
|
24
|
+
:send-message-path="sendMessagePath"
|
|
25
|
+
:lang="(lang as any)"
|
|
25
26
|
:data-name="dataName"
|
|
26
27
|
:session-from="sessionFrom"
|
|
27
28
|
:send-message-img="sendMessageImg"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { CalendarChangeDate, CalendarChangeRange, CalendarMode, ThemeType } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
4
|
import { getColor, useLocale } from '../../';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
@tap.stop.prevent
|
|
9
9
|
>
|
|
10
10
|
<block v-if="!slots.default && !slots.$default">
|
|
11
|
-
<scroll-view scroll-y="true" :style="{ height: $u.addUnit(height) }">
|
|
11
|
+
<scroll-view :scroll-y="true" :style="{ height: $u.addUnit(String(height)) }">
|
|
12
12
|
<view class="u-dropdown-item__options">
|
|
13
13
|
<u-cell-group>
|
|
14
14
|
<u-cell-item
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
43
|
<script setup lang="ts">
|
|
44
|
-
import { directionConfig, FabProps } from './types
|
|
44
|
+
import { directionConfig, FabProps } from './types';
|
|
45
45
|
import { computed, getCurrentInstance, onMounted, reactive, ref, useSlots, watch } from 'vue';
|
|
46
46
|
import { $u } from '../../';
|
|
47
47
|
|
|
@@ -9,17 +9,17 @@ import { baseProps } from '../common/props';
|
|
|
9
9
|
export const FieldProps = {
|
|
10
10
|
...baseProps,
|
|
11
11
|
/** label左边的图标,限uView的图标名称 */
|
|
12
|
-
icon: String,
|
|
12
|
+
icon: { type: String, default: '' },
|
|
13
13
|
/** 输入框右边的图标名称,限uView的图标名称(默认false) */
|
|
14
|
-
rightIcon: String,
|
|
14
|
+
rightIcon: { type: String, default: '' },
|
|
15
15
|
/** 方向属性 */
|
|
16
16
|
arrowDirection: { type: String, default: 'right' },
|
|
17
17
|
/** 是否必填,左边显示红色"*"号(默认false) */
|
|
18
|
-
required: Boolean,
|
|
18
|
+
required: { type: Boolean, default: false },
|
|
19
19
|
/** 输入框左边的文字提示 */
|
|
20
|
-
label: String,
|
|
20
|
+
label: { type: String, default: '' },
|
|
21
21
|
/** 是否密码输入方式(用点替换文字),type为text时有效(默认false) */
|
|
22
|
-
password: Boolean,
|
|
22
|
+
password: { type: Boolean, default: false },
|
|
23
23
|
/** 是否显示右侧清空内容的图标控件(默认true) */
|
|
24
24
|
clearable: { type: Boolean, default: true },
|
|
25
25
|
/** label的宽度,单位rpx(默认130) */
|
|
@@ -35,13 +35,13 @@ export const FieldProps = {
|
|
|
35
35
|
/** 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息 */
|
|
36
36
|
errorMessage: { type: [String, Boolean] as PropType<string | boolean>, default: '' },
|
|
37
37
|
/** 输入框的提示文字 */
|
|
38
|
-
placeholder: String,
|
|
38
|
+
placeholder: { type: String, default: '' },
|
|
39
39
|
/** placeholder的样式(内联样式,字符串),如"color: var(--u-divider-color)" */
|
|
40
|
-
placeholderStyle: String,
|
|
40
|
+
placeholderStyle: { type: String, default: '' },
|
|
41
41
|
/** 是否自动获得焦点(默认false) */
|
|
42
|
-
focus: Boolean,
|
|
42
|
+
focus: { type: Boolean, default: false },
|
|
43
43
|
/** 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false) */
|
|
44
|
-
fixed: Boolean,
|
|
44
|
+
fixed: { type: Boolean, default: false },
|
|
45
45
|
/** 输入框绑定值 */
|
|
46
46
|
modelValue: [Number, String],
|
|
47
47
|
/** 输入框类型(text/textarea/password等,默认text) */
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
<textarea
|
|
36
36
|
v-if="props.type === 'textarea'"
|
|
37
37
|
class="u-flex-1 u-textarea-class"
|
|
38
|
-
:style="
|
|
39
|
-
:value="props.modelValue"
|
|
40
|
-
:placeholder="props.placeholder"
|
|
38
|
+
:style="$u.toStyle(props.fieldStyle)"
|
|
39
|
+
:value="String(props.modelValue)"
|
|
40
|
+
:placeholder="String(props.placeholder)"
|
|
41
41
|
:placeholderStyle="props.placeholderStyle"
|
|
42
42
|
:disabled="props.disabled"
|
|
43
43
|
:maxlength="inputMaxlength"
|
|
@@ -50,14 +50,15 @@
|
|
|
50
50
|
@confirm="onConfirm"
|
|
51
51
|
@tap="fieldClick"
|
|
52
52
|
/>
|
|
53
|
+
<!-- prettier-ignore -->
|
|
53
54
|
<input
|
|
54
55
|
v-else
|
|
55
|
-
:style="[props.fieldStyle]"
|
|
56
|
-
:type="props.type"
|
|
57
56
|
class="u-flex-1 u-field__input-wrap"
|
|
58
|
-
:
|
|
57
|
+
:style="$u.toStyle(props.fieldStyle)"
|
|
58
|
+
:type="(props.type as any)"
|
|
59
|
+
:value="String(props.modelValue)"
|
|
59
60
|
:password="props.password || props.type === 'password'"
|
|
60
|
-
:placeholder="props.placeholder"
|
|
61
|
+
:placeholder="String(props.placeholder)"
|
|
61
62
|
:placeholderStyle="props.placeholderStyle"
|
|
62
63
|
:disabled="props.disabled"
|
|
63
64
|
:maxlength="inputMaxlength"
|
|
@@ -350,7 +350,7 @@ onMounted(() => {
|
|
|
350
350
|
// 继承父表单配置
|
|
351
351
|
// 历遍parentData中的属性,将parent中的同名属性赋值给parentData
|
|
352
352
|
Object.keys(parentData.value).forEach(key => {
|
|
353
|
-
parentData.value[key] = parentExposed?.value?.props[key];
|
|
353
|
+
(parentData.value as any)[key] = parentExposed?.value?.props[key];
|
|
354
354
|
});
|
|
355
355
|
// 如果没有传入prop,或者uForm为空(如果u-form-input单独使用,就不会有uForm注入),就不进行校验
|
|
356
356
|
if (props.prop) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { ImgMode, Shape } from '../../types/global';
|
|
3
3
|
import { baseProps } from '../common/props';
|
|
4
4
|
|
|
@@ -62,23 +62,23 @@ onMounted(() => {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
function setTop(val) {
|
|
65
|
+
function setTop(val: any) {
|
|
66
66
|
top.value = val;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function setHeight(val) {
|
|
69
|
+
function setHeight(val: any) {
|
|
70
70
|
height.value = val;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
function setActive(val) {
|
|
73
|
+
function setActive(val: any) {
|
|
74
74
|
active.value = val;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
function setAnchorStyle(val) {
|
|
77
|
+
function setAnchorStyle(val: any) {
|
|
78
78
|
anchorStyle.value = val;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function setWrapperStyle(val) {
|
|
81
|
+
function setWrapperStyle(val: any) {
|
|
82
82
|
wrapperStyle.value = val;
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
v-if="type == 'textarea'"
|
|
20
20
|
class="u-input__input u-input__textarea"
|
|
21
21
|
:style="getStyle"
|
|
22
|
-
:value="defaultValue"
|
|
22
|
+
:value="String(defaultValue)"
|
|
23
23
|
:placeholder="placeholder"
|
|
24
24
|
:placeholderStyle="placeholderStyle"
|
|
25
25
|
:disabled="disabled"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
:fixed="fixed"
|
|
28
28
|
:focus="focus"
|
|
29
29
|
:autoHeight="autoHeight"
|
|
30
|
-
:selection-end="uSelectionEnd"
|
|
31
|
-
:selection-start="uSelectionStart"
|
|
30
|
+
:selection-end="Number(uSelectionEnd)"
|
|
31
|
+
:selection-start="Number(uSelectionStart)"
|
|
32
32
|
:cursor-spacing="getCursorSpacing"
|
|
33
33
|
:show-confirm-bar="showConfirmbar"
|
|
34
34
|
:adjust-position="adjustPosition"
|
|
@@ -37,12 +37,13 @@
|
|
|
37
37
|
@focus="onFocus"
|
|
38
38
|
@confirm="onConfirm"
|
|
39
39
|
/>
|
|
40
|
+
<!-- prettier-ignore -->
|
|
40
41
|
<input
|
|
41
42
|
v-else
|
|
42
43
|
class="u-input__input"
|
|
43
|
-
:type="type == 'password' ? 'text' : type"
|
|
44
|
+
:type="((type == 'password' ? 'text' : type) as any)"
|
|
44
45
|
:style="getStyle"
|
|
45
|
-
:value="defaultValue"
|
|
46
|
+
:value="String(defaultValue)"
|
|
46
47
|
:password="type == 'password' && !showPassword"
|
|
47
48
|
:placeholder="placeholder"
|
|
48
49
|
:placeholderStyle="placeholderStyle"
|
|
@@ -51,8 +52,8 @@
|
|
|
51
52
|
:focus="focus"
|
|
52
53
|
:confirmType="confirmType"
|
|
53
54
|
:cursor-spacing="getCursorSpacing"
|
|
54
|
-
:selection-end="uSelectionEnd"
|
|
55
|
-
:selection-start="uSelectionStart"
|
|
55
|
+
:selection-end="Number(uSelectionEnd)"
|
|
56
|
+
:selection-start="Number(uSelectionStart)"
|
|
56
57
|
:show-confirm-bar="showConfirmbar"
|
|
57
58
|
:adjust-position="adjustPosition"
|
|
58
59
|
@focus="onFocus"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
type LoadingMode = 'circle' | 'flower';
|
|
4
5
|
|
|
@@ -7,6 +8,7 @@ type LoadingMode = 'circle' | 'flower';
|
|
|
7
8
|
* @description 加载动画,支持多种模式
|
|
8
9
|
*/
|
|
9
10
|
export const LoadingProps = {
|
|
11
|
+
...baseProps,
|
|
10
12
|
/** 动画的类型 */
|
|
11
13
|
mode: {
|
|
12
14
|
type: String as PropType<LoadingMode>,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<view
|
|
3
3
|
v-if="show"
|
|
4
4
|
class="u-loading"
|
|
5
|
-
:class="mode === 'circle' ? 'u-loading-circle' : 'u-loading-flower'"
|
|
6
|
-
:style="
|
|
5
|
+
:class="[mode === 'circle' ? 'u-loading-circle' : 'u-loading-flower', customClass]"
|
|
6
|
+
:style="$u.toStyle(cricleStyle, customStyle)"
|
|
7
7
|
>
|
|
8
8
|
</view>
|
|
9
9
|
</template>
|
|
@@ -24,6 +24,7 @@ export default {
|
|
|
24
24
|
<script setup lang="ts">
|
|
25
25
|
import { computed } from 'vue';
|
|
26
26
|
import { LoadingProps } from './types';
|
|
27
|
+
import { $u } from '../../';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* loading 加载动画
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { LoadmoreIconType, LoadmoreStatus, LoadmoreText } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
import { useLocale } from '../../';
|
|
4
5
|
|
|
5
6
|
const { t } = useLocale();
|
|
@@ -10,6 +11,7 @@ const { t } = useLocale();
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
export const LoadmoreProps = {
|
|
14
|
+
...baseProps,
|
|
13
15
|
/** 组件背景色 */
|
|
14
16
|
bgColor: {
|
|
15
17
|
type: String,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="u-load-more-wrap"
|
|
4
|
-
:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
:class="props.customClass"
|
|
5
|
+
:style="
|
|
6
|
+
$u.toStyle(props.customStyle, {
|
|
7
|
+
backgroundColor: props.bgColor,
|
|
8
|
+
marginBottom: props.marginBottom + 'rpx',
|
|
9
|
+
marginTop: props.marginTop + 'rpx',
|
|
10
|
+
height: $u.addUnit(props.height)
|
|
11
|
+
})
|
|
12
|
+
"
|
|
10
13
|
>
|
|
11
14
|
<u-line color="var(--u-divider-color)" length="50"></u-line>
|
|
12
15
|
<!-- 加载中和没有更多的状态才显示两边的横线 -->
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
<!-- 如果没有更多的状态下,显示内容为dot(粗点),加载特定样式 -->
|
|
23
26
|
<view
|
|
24
27
|
class="u-line-1"
|
|
25
|
-
:style="loadTextStyle"
|
|
28
|
+
:style="$u.toStyle(loadTextStyle)"
|
|
26
29
|
:class="[props.status == 'nomore' && props.isDot == true ? 'u-dot-text' : 'u-more-text']"
|
|
27
30
|
@tap="loadMore"
|
|
28
31
|
>
|
|
@@ -79,7 +82,7 @@ const loadTextStyle = computed(() => {
|
|
|
79
82
|
return {
|
|
80
83
|
color: props.color,
|
|
81
84
|
fontSize: props.fontSize + 'rpx',
|
|
82
|
-
position: 'relative',
|
|
85
|
+
position: 'relative' as const,
|
|
83
86
|
zIndex: 1,
|
|
84
87
|
backgroundColor: props.bgColor
|
|
85
88
|
// 如果是加载中状态,动画和文字需要距离近一点
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-char-box" :class="customClass" :style="$u.toStyle(customStyle)">
|
|
3
3
|
<view class="u-char-flex">
|
|
4
|
+
<!-- prettier-ignore -->
|
|
4
5
|
<input
|
|
5
6
|
:disabled="props.disabledKeyboard"
|
|
6
7
|
:value="valueModel"
|
|
7
|
-
:type="type"
|
|
8
|
+
:type="(type as any)"
|
|
8
9
|
:focus="props.focus"
|
|
9
|
-
:maxlength="props.maxlength"
|
|
10
|
+
:maxlength="Number(props.maxlength)"
|
|
10
11
|
class="u-input"
|
|
11
12
|
@input="getVal"
|
|
12
13
|
/>
|
|
@@ -137,7 +138,7 @@ const loopCharArr = computed(() => new Array(Number(props.maxlength)));
|
|
|
137
138
|
* 输入事件处理
|
|
138
139
|
* @param e input事件对象
|
|
139
140
|
*/
|
|
140
|
-
function getVal(e:
|
|
141
|
+
function getVal(e: any) {
|
|
141
142
|
const { value } = e.detail;
|
|
142
143
|
valueModel.value = value;
|
|
143
144
|
// 判断长度是否超出了maxlength值,理论上不会发生,因为input组件设置了maxlength属性值
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* u-modal 函数式调用事件名(全平台)
|
|
3
|
+
* @description
|
|
4
|
+
* - useModal() 通过 uni.$emit 派发事件
|
|
5
|
+
* - <u-modal /> 通过 uni.$on 监听事件并转调自身 show/hide
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ModalProps } from './types';
|
|
9
|
+
|
|
10
|
+
// 普通(页面级)modal 事件
|
|
11
|
+
export const U_MODAL_EVENT_SHOW = 'uview-pro:u-modal:show';
|
|
12
|
+
export const U_MODAL_EVENT_HIDE = 'uview-pro:u-modal:hide';
|
|
13
|
+
export const U_MODAL_EVENT_CLEAR_LOADING = 'uview-pro:u-modal:clear-loading';
|
|
14
|
+
|
|
15
|
+
// 全局(App 根部)modal 事件,供 useModal() 使用
|
|
16
|
+
export const U_MODAL_GLOBAL_EVENT_SHOW = 'uview-pro:u-modal:global:show';
|
|
17
|
+
export const U_MODAL_GLOBAL_EVENT_HIDE = 'uview-pro:u-modal:global:hide';
|
|
18
|
+
export const U_MODAL_GLOBAL_EVENT_CLEAR_LOADING = 'uview-pro:u-modal:global:clear-loading';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* u-modal 函数式调用载荷类型
|
|
22
|
+
* @description 完整覆盖 u-modal 的所有 props(除 modelValue 外)
|
|
23
|
+
*/
|
|
24
|
+
export type ModalPayload = Partial<Omit<ModalProps, 'modelValue'>> & {
|
|
25
|
+
/** 确认回调 */
|
|
26
|
+
onConfirm?: () => void;
|
|
27
|
+
/** 取消回调 */
|
|
28
|
+
onCancel?: () => void;
|
|
29
|
+
};
|
|
@@ -33,7 +33,7 @@ export const ModalProps = {
|
|
|
33
33
|
/** 弹窗内容 */
|
|
34
34
|
content: {
|
|
35
35
|
type: String,
|
|
36
|
-
default:
|
|
36
|
+
default: ''
|
|
37
37
|
},
|
|
38
38
|
/** 是否显示标题 */
|
|
39
39
|
showTitle: {
|
|
@@ -114,6 +114,16 @@ export const ModalProps = {
|
|
|
114
114
|
negativeTop: {
|
|
115
115
|
type: [String, Number] as PropType<number | string>,
|
|
116
116
|
default: 0
|
|
117
|
+
},
|
|
118
|
+
/** 是否作为全局根部 modal(通常放在 App.vue 中,给 useModal() 使用) */
|
|
119
|
+
global: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: false
|
|
122
|
+
},
|
|
123
|
+
/** 是否作为页面级 modal(通常放在页面中,给 useModal({ page: true }) 使用) */
|
|
124
|
+
page: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: false
|
|
117
127
|
}
|
|
118
128
|
};
|
|
119
129
|
|