uview-pro 0.0.16 → 0.0.18

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 CHANGED
@@ -1,12 +1,43 @@
1
- ## 0.0.15(2025-08-30
2
- ### Features | 新功能
1
+ ## 0.0.18(2025-09-03
3
2
 
4
- - 优化 u-image 组件 slot 使用体验,兼容头条小程序 ([a6ca54f](https://github.com/anyup/uView-Pro/commit/a6ca54fce06b20b7a6938d0bef9342954b787641))
3
+ ### 🚀 Chore | 构建/工程依赖/工具
5
4
 
6
- ### Bug Fixes | Bug 修复
5
+ - update release script for better version management ([b64f38f](https://github.com/anyup/uView-Pro/commit/b64f38fea28de39c99cdf84f7e767aa7ceac1344))
7
6
 
8
- - 优化 label 的声明错误问题 ([314c394](https://github.com/anyup/uView-Pro/commit/314c3940145c657b12f16d005af7d271f4ae74e3))
9
- - 优化头条小程序 form 表单校验的兼容性问题 ([3912fd6](https://github.com/anyup/uView-Pro/commit/3912fd6ade3a1d612f6f5e86ddc0336376ee5618))
7
+ ### 🐛 Bug Fixes | Bug 修复
8
+
9
+ - **u-checkbox:** 兼容头条小程序获取父组件数据不支持provide/inject的写法 ([498e12e](https://github.com/anyup/uView-Pro/commit/498e12e2f3aa52021d1be282426536b45f39ca6a))
10
+
11
+ ### 👷 Continuous Integration | CI 配置
12
+
13
+ - optimize changelog generation and spacing ([3103e7b](https://github.com/anyup/uView-Pro/commit/3103e7b56a0e2dd0392efdb6a85824b11ef6800c))
14
+
15
+ ## 0.0.17(2025-09-02)
16
+
17
+ ### ♻️ Code Refactoring | 代码重构
18
+
19
+ - 瀑布流组件示例代码重构为 Vue3 ([93949ad](https://github.com/anyup/uView-Pro/commit/93949ad8ae2a36c6130f87340c222ab9ec69d21f))
20
+
21
+ ### ✨ Features | 新功能
22
+
23
+ - 新增组件 u-loading-popup,一个可以配置的加载提示弹窗 ([6245df9](https://github.com/anyup/uView-Pro/commit/6245df951034b06225ab36d3f18cae8e7ab4b329))
24
+ - 新增 Loading 加载弹窗组件的示例页面 ([1bce868](https://github.com/anyup/uView-Pro/commit/1bce86810863012c5a73104ca0a85ebacb4aa92a))
25
+
26
+ ### 🐛 Bug Fixes | Bug 修复
27
+
28
+ - 修复瀑布流组件 u-waterfll,暴露 celar/remove/modify 方法 ([240e023](https://github.com/anyup/uView-Pro/commit/240e0238af092d4c6bde86d0db9e49636b806d6f))
29
+
30
+ ## 0.0.15(2025-08-30)
31
+
32
+ ### ✨ Features | 新功能
33
+
34
+ - 优化 u-image 组件 slot 使用体验,兼容头条小程序 ([a6ca54f](https://github.com/anyup/uView-Pro/commit/a6ca54fce06b20b7a6938d0bef9342954b787641))
35
+
36
+ ### ♻️ Bug Fixes | Bug 修复
37
+
38
+ - 优化 label 的声明错误问题 ([314c394](https://github.com/anyup/uView-Pro/commit/314c3940145c657b12f16d005af7d271f4ae74e3))
39
+ - 优化头条小程序 form 表单校验的兼容性问题 ([3912fd6](https://github.com/anyup/uView-Pro/commit/3912fd6ade3a1d612f6f5e86ddc0336376ee5618))
40
+
10
41
  ## 0.0.14(2025-08-28)
11
42
 
12
43
  ### 🐛 Bug Fixes | Bug 修复
@@ -43,21 +43,23 @@ const props = defineProps(CheckboxProps);
43
43
 
44
44
  const emit = defineEmits(['change', 'update:modelValue']);
45
45
 
46
+ const instance = getCurrentInstance();
47
+ const instanceProxy = instance?.proxy;
46
48
  // 父组件 group 注入
47
- // 支付宝小程序不支持provide/inject
48
- const parent = inject<any>('u-checkbox-group', null);
49
+ let parent = inject<any>('u-checkbox-group', null);
49
50
 
50
51
  // 组件注册到 group
51
52
  onMounted(() => {
53
+ // 兼容头条小程序不支持provide/inject
54
+ // #ifdef MP-TOUTIAO
55
+ parent = $u.parentData('u-checkbox-group', instance);
56
+ // #endif
52
57
  // 如果存在u-checkbox-group,将本组件的实例塞进父组件的children中
53
58
  if (parent && parent.children && !parent.children.value.includes(instanceProxy)) {
54
59
  parent.children.value.push(instanceProxy);
55
60
  }
56
61
  });
57
62
 
58
- const instance = getCurrentInstance();
59
- const instanceProxy = instance?.proxy;
60
-
61
63
  // 是否禁用,如果父组件u-checkbox-group禁用的话,将会忽略子组件的配置
62
64
  const isDisabled = computed(() => {
63
65
  return props.disabled !== '' ? props.disabled : parent ? parent.props.disabled : false;
@@ -1,19 +1,26 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
+ type LoadingMode = 'circle' | 'flower';
2
3
 
3
4
  /**
4
5
  * u-loading-popup 组件 props 类型定义
5
6
  */
6
7
  export const LoadingPopupProps = {
7
- /** 是否显示加载弹窗 */
8
- modelValue: { type: Boolean, default: false },
9
- /** 加载提示文本 */
10
- text: { type: String, default: '' },
11
- /** 方向,可选 'vertical' | 'horizontal' */
12
- direction: { type: String as PropType<'vertical' | 'horizontal'>, default: 'vertical' },
13
- /** 自动关闭的持续时间(ms),0为不自动关闭 */
14
- duration: { type: Number, default: 0 },
15
- /** 允许点击遮罩关闭的最短时间(ms) */
16
- cancelTime: { type: Number, default: 10000 }
8
+ /** 是否显示加载弹窗 */
9
+ modelValue: { type: Boolean, default: false },
10
+ /** 加载提示文本 */
11
+ text: { type: String, default: '' },
12
+ /** 方向,可选 'vertical' | 'horizontal' */
13
+ direction: { type: String as PropType<'vertical' | 'horizontal'>, default: 'vertical' },
14
+ /** 自动关闭的持续时间(ms),0为不自动关闭 */
15
+ duration: { type: Number, default: 0 },
16
+ /** 允许点击遮罩关闭的最短时间(ms) */
17
+ cancelTime: { type: Number, default: 10000 },
18
+ /** 动画的类型 */
19
+ mode: { type: String as PropType<LoadingMode>, default: 'circle' },
20
+ /** 动画的颜色 */
21
+ color: { type: String, default: '#c7c7c7' },
22
+ /** 加载图标的大小,单位rpx */
23
+ size: { type: [String, Number] as PropType<string | number>, default: '48' }
17
24
  };
18
25
 
19
26
  export type LoadingPopupProps = ExtractPropTypes<typeof LoadingPopupProps>;
@@ -1,27 +1,30 @@
1
1
  <template>
2
2
  <view @touchmove.stop.prevent>
3
3
  <view v-if="popupValue" class="u-loading-init" :class="[direction]">
4
- <view class="u-loading-center"></view>
5
- <view v-if="currentText" class="u-loading-tips">{{ currentText }}</view>
4
+ <u-loading :mode="mode" :color="color" :size="size" />
5
+ <view v-if="currentText" class="u-loading-tips">
6
+ {{ currentText }}
7
+ </view>
6
8
  </view>
7
- <view class="u-loading-mask" :class="[popupValue ? 'u-mask-show' : '']" @click="onMaskClick"></view>
9
+ <view class="u-loading-mask" :class="[popupValue ? 'u-mask-show' : '']" @click="onMaskClick" />
8
10
  </view>
9
11
  </template>
10
-
11
12
  <script lang="ts" setup>
12
- import { ref, watch, onUnmounted, computed } from 'vue';
13
+ import { computed, onUnmounted, ref, watch } from 'vue';
13
14
  import { LoadingPopupProps } from './types';
14
15
 
15
16
  // 组件props类型
16
17
  const props = defineProps(LoadingPopupProps);
17
18
  const emit = defineEmits(['update:modelValue', 'cancel']);
18
19
 
19
- // 定时器
20
- let timer: ReturnType<typeof setTimeout> | null = null;
20
+ // 自动关闭的持续时间定时器
21
+ let durationTimer: ReturnType<typeof setTimeout> | null = null;
22
+ // 关闭按钮倒计时定时器
23
+ let cancelTimer: ReturnType<typeof setTimeout> | null = null;
21
24
  // 记录弹窗显示的时间戳
22
25
  const now = ref(0);
23
- // 是否显示关闭按钮(超时后)
24
- const closeShow = ref(false);
26
+ // 点击遮罩层是否可关闭(超时后)
27
+ const canClose = ref(false);
25
28
  // 当前显示的text,优先级:loading参数 > props.text
26
29
  const currentText = ref(props.text);
27
30
 
@@ -30,75 +33,136 @@ const popupValue = computed({
30
33
  set: (val: boolean) => emit('update:modelValue', val)
31
34
  });
32
35
 
33
- // 监听props.text变化,自动同步到currentText(仅在未手动传入text时)
36
+ watch(
37
+ () => popupValue.value,
38
+ val => {
39
+ if (val) {
40
+ doOpen(currentText.value);
41
+ } else {
42
+ doClose();
43
+ }
44
+ }
45
+ );
46
+
47
+ // 响应 props 变更,自动刷新当前 text
34
48
  watch(
35
49
  () => props.text,
36
50
  val => {
37
- if (!currentText.value || currentText.value === '' || currentText.value === undefined) {
38
- currentText.value = val;
51
+ currentText.value = val;
52
+ }
53
+ );
54
+
55
+ // 响应 cancelTime/duration 变化,重启定时器
56
+ watch(
57
+ () => [props.cancelTime, props.duration],
58
+ () => {
59
+ if (popupValue.value) {
60
+ clearDurationTimer();
61
+ startCancelTime();
62
+ startDurationTime();
39
63
  }
40
64
  }
41
65
  );
42
66
 
43
- // 启动超时关闭按钮计时
44
- function startTime() {
45
- setTimeout(() => {
46
- closeShow.value = true;
47
- }, props.cancelTime);
67
+ /**
68
+ * 启动超时关闭按钮计时
69
+ */
70
+ function startCancelTime() {
71
+ clearCancelTimer();
72
+ canClose.value = false;
73
+ if (props.cancelTime > 0) {
74
+ cancelTimer = setTimeout(() => {
75
+ canClose.value = true;
76
+ }, props.cancelTime);
77
+ }
78
+ }
79
+
80
+ /**
81
+ * 启动持续时间计时
82
+ */
83
+ function startDurationTime() {
84
+ clearDurationTimer();
85
+ if (props.duration) {
86
+ durationTimer = setTimeout(() => {
87
+ close();
88
+ }, props.duration);
89
+ }
48
90
  }
49
91
 
50
- // loading主逻辑,支持传入text,优先显示传入的text
51
- function show(text?: string) {
52
- console.log('show');
92
+ /**
93
+ * 内部显示逻辑,初始化所有状态
94
+ */
95
+ function doOpen(text?: string) {
96
+ canClose.value = false;
97
+ clearDurationTimer();
98
+ clearCancelTimer();
99
+ now.value = Date.now();
53
100
  if (typeof text === 'string' && text !== '') {
54
101
  currentText.value = text;
55
102
  } else {
56
103
  currentText.value = props.text;
57
104
  }
58
- startTime();
59
- clearTimer();
60
- now.value = Date.now();
61
- if (props.duration) {
62
- timer = setTimeout(() => {
63
- hide();
64
- }, props.duration);
65
- }
66
- emit('update:modelValue', true);
105
+ startCancelTime();
106
+ startDurationTime();
107
+ }
108
+
109
+ /**
110
+ * 内部关闭逻辑,重置所有状态
111
+ */
112
+ function doClose() {
113
+ canClose.value = false;
114
+ currentText.value = props.text;
115
+ clearDurationTimer();
116
+ clearCancelTimer();
117
+ }
118
+
119
+ /**
120
+ * 显示弹窗
121
+ * @param text 可选,优先显示的文案
122
+ */
123
+ function open(text?: string) {
124
+ currentText.value = text || props.text;
125
+ popupValue.value = true;
126
+ }
127
+
128
+ /**
129
+ * 隐藏弹窗
130
+ */
131
+ function close() {
132
+ popupValue.value = false;
67
133
  }
68
134
 
69
135
  // 清理定时器
70
- function clearTimer() {
71
- if (timer) {
72
- clearTimeout(timer);
73
- timer = null;
136
+ function clearDurationTimer() {
137
+ if (durationTimer) {
138
+ clearTimeout(durationTimer);
139
+ durationTimer = null;
74
140
  }
75
141
  }
76
-
77
- // 完成加载,关闭弹窗
78
- function hide() {
79
- console.log('hide');
80
- closeShow.value = false;
81
- clearTimer();
82
- // 关闭时重置currentText为props.text,避免下次未传text时显示旧内容
83
- currentText.value = props.text;
84
- emit('update:modelValue', false);
142
+ function clearCancelTimer() {
143
+ if (cancelTimer) {
144
+ clearTimeout(cancelTimer);
145
+ cancelTimer = null;
146
+ }
85
147
  }
86
148
 
87
149
  // 遮罩点击事件
88
150
  function onMaskClick() {
89
- if (Date.now() - now.value > props.cancelTime) {
151
+ // 只有显示关闭按钮时才允许关闭
152
+ if (canClose.value) {
90
153
  emit('cancel');
91
- hide();
154
+ close();
92
155
  }
93
156
  }
94
157
 
95
158
  onUnmounted(() => {
96
- clearTimer();
159
+ clearDurationTimer();
160
+ clearCancelTimer();
97
161
  });
98
162
 
99
163
  defineExpose({
100
- show,
101
- hide
164
+ open,
165
+ close
102
166
  });
103
167
  </script>
104
168
 
@@ -126,6 +190,7 @@ defineExpose({
126
190
  min-width: 200rpx;
127
191
  min-height: 200rpx;
128
192
  max-width: 500rpx;
193
+ padding: 15rpx 0;
129
194
  display: flex;
130
195
  align-items: center;
131
196
  justify-content: center;
@@ -139,6 +204,7 @@ defineExpose({
139
204
  color: #fff;
140
205
  background: rgba(0, 0, 0, 0.7);
141
206
  border-radius: 7px;
207
+
142
208
  .u-icon-close {
143
209
  position: absolute;
144
210
  top: 4rpx;
@@ -146,6 +212,7 @@ defineExpose({
146
212
  color: #ffffff;
147
213
  opacity: 0.8;
148
214
  }
215
+
149
216
  &.horizontal {
150
217
  flex-direction: row;
151
218
  align-items: center;
@@ -154,10 +221,7 @@ defineExpose({
154
221
  max-width: 600rpx;
155
222
  min-height: 150rpx;
156
223
  padding-left: 40rpx;
157
- .u-loading-center {
158
- width: 70rpx;
159
- height: 70rpx;
160
- }
224
+
161
225
  .u-loading-tips {
162
226
  margin-top: 0;
163
227
  margin-left: 20rpx;
@@ -166,43 +230,10 @@ defineExpose({
166
230
  }
167
231
  }
168
232
 
169
- .u-loading-center {
170
- width: 60rpx;
171
- height: 60rpx;
172
- border: 3px solid #fff;
173
- border-color: #8f8d8e #8f8d8e #8f8d8e #ffffff;
174
- border-radius: 50%;
175
- margin: 0 6px;
176
- display: inline-block;
177
- vertical-align: middle;
178
- /* clip-path: polygon(0% 0%, 100% 0%, 100% 60%, 0% 60%); */
179
- animation: rotate 1s linear infinite;
180
- }
181
-
182
233
  .u-loading-tips {
183
234
  text-align: center;
184
235
  padding: 0 20rpx;
185
236
  box-sizing: border-box;
186
237
  margin-top: 36rpx;
187
238
  }
188
-
189
- @-webkit-keyframes rotate {
190
- from {
191
- transform: rotatez(0deg);
192
- }
193
-
194
- to {
195
- transform: rotatez(360deg);
196
- }
197
- }
198
-
199
- @keyframes rotate {
200
- from {
201
- transform: rotatez(0deg);
202
- }
203
-
204
- to {
205
- transform: rotatez(360deg);
206
- }
207
- }
208
239
  </style>
@@ -146,6 +146,11 @@ function modify(id: string | number, key: string, value: any) {
146
146
  emit('update:modelValue', data);
147
147
  }
148
148
  }
149
+ defineExpose({
150
+ clear,
151
+ remove,
152
+ modify
153
+ });
149
154
  </script>
150
155
 
151
156
  <style lang="scss" scoped>
package/package.json CHANGED
@@ -1,107 +1,107 @@
1
- {
2
- "id": "uview-pro",
3
- "name": "uview-pro",
4
- "displayName": "【Vue3重构版】uView Pro|基于Vue3+TS全面重构的70+精选UI组件库",
5
- "version": "0.0.16",
6
- "description": "uView Pro,是全面支持Vue3的uni-app生态框架,70+精选组件已使用TypeScript重构,已全面支持uni-app Vue3.0",
7
- "main": "index.ts",
8
- "module": "index.ts",
9
- "browser": "index.ts",
10
- "keywords": [
11
- "uni-app",
12
- "library",
13
- "component",
14
- "uView",
15
- "Vue3"
16
- ],
17
- "author": "anyup",
18
- "license": "MIT",
19
- "repository": "https://github.com/anyup/uview-pro",
20
- "engines": {
21
- "HBuilderX": "^4.07",
22
- "uni-app": "^4.07",
23
- "uni-app-x": ""
24
- },
25
- "dcloudext": {
26
- "type": "component-vue",
27
- "sale": {
28
- "regular": {
29
- "price": "0.00"
30
- },
31
- "sourcecode": {
32
- "price": "0.00"
33
- }
34
- },
35
- "contact": {
36
- "qq": "491302297"
37
- },
38
- "declaration": {
39
- "ads": "无",
40
- "data": "无",
41
- "permissions": "无"
42
- },
43
- "npmurl": "https://www.npmjs.com/package/uview-pro",
44
- "darkmode": "x",
45
- "i18n": "x",
46
- "widescreen": "x"
47
- },
48
- "uni_modules": {
49
- "dependencies": [],
50
- "encrypt": [],
51
- "platforms": {
52
- "cloud": {
53
- "tcb": "√",
54
- "aliyun": "√",
55
- "alipay": "√"
56
- },
57
- "client": {
58
- "uni-app": {
59
- "vue": {
60
- "vue2": "x",
61
- "vue3": "√"
62
- },
63
- "web": {
64
- "safari": "√",
65
- "chrome": "√"
66
- },
67
- "app": {
68
- "vue": "√",
69
- "nvue": "-",
70
- "android": "√",
71
- "ios": "√",
72
- "harmony": "-"
73
- },
74
- "mp": {
75
- "weixin": "√",
76
- "alipay": "-",
77
- "toutiao": "-",
78
- "baidu": "-",
79
- "kuaishou": "-",
80
- "jd": "-",
81
- "harmony": "-",
82
- "qq": "-",
83
- "lark": "-"
84
- },
85
- "quickapp": {
86
- "huawei": "-",
87
- "union": "-"
88
- }
89
- },
90
- "uni-app-x": {
91
- "web": {
92
- "safari": "-",
93
- "chrome": "-"
94
- },
95
- "app": {
96
- "android": "-",
97
- "ios": "-",
98
- "harmony": "-"
99
- },
100
- "mp": {
101
- "weixin": "-"
102
- }
103
- }
104
- }
105
- }
106
- }
107
- }
1
+ {
2
+ "id": "uview-pro",
3
+ "name": "uview-pro",
4
+ "displayName": "【Vue3重构版】uView Pro|基于Vue3+TS全面重构的70+精选UI组件库",
5
+ "version": "0.0.18",
6
+ "description": "uView Pro,是全面支持Vue3的uni-app生态框架,70+精选组件已使用TypeScript重构,已全面支持uni-app Vue3.0",
7
+ "main": "index.ts",
8
+ "module": "index.ts",
9
+ "browser": "index.ts",
10
+ "keywords": [
11
+ "uni-app",
12
+ "library",
13
+ "component",
14
+ "uView",
15
+ "Vue3"
16
+ ],
17
+ "author": "anyup",
18
+ "license": "MIT",
19
+ "repository": "https://github.com/anyup/uview-pro",
20
+ "engines": {
21
+ "HBuilderX": "^4.07",
22
+ "uni-app": "^4.07",
23
+ "uni-app-x": ""
24
+ },
25
+ "dcloudext": {
26
+ "type": "component-vue",
27
+ "sale": {
28
+ "regular": {
29
+ "price": "0.00"
30
+ },
31
+ "sourcecode": {
32
+ "price": "0.00"
33
+ }
34
+ },
35
+ "contact": {
36
+ "qq": "491302297"
37
+ },
38
+ "declaration": {
39
+ "ads": "无",
40
+ "data": "无",
41
+ "permissions": "无"
42
+ },
43
+ "npmurl": "https://www.npmjs.com/package/uview-pro",
44
+ "darkmode": "x",
45
+ "i18n": "x",
46
+ "widescreen": "x"
47
+ },
48
+ "uni_modules": {
49
+ "dependencies": [],
50
+ "encrypt": [],
51
+ "platforms": {
52
+ "cloud": {
53
+ "tcb": "√",
54
+ "aliyun": "√",
55
+ "alipay": "√"
56
+ },
57
+ "client": {
58
+ "uni-app": {
59
+ "vue": {
60
+ "vue2": "x",
61
+ "vue3": "√"
62
+ },
63
+ "web": {
64
+ "safari": "√",
65
+ "chrome": "√"
66
+ },
67
+ "app": {
68
+ "vue": "√",
69
+ "nvue": "-",
70
+ "android": "√",
71
+ "ios": "√",
72
+ "harmony": "-"
73
+ },
74
+ "mp": {
75
+ "weixin": "√",
76
+ "alipay": "-",
77
+ "toutiao": "-",
78
+ "baidu": "-",
79
+ "kuaishou": "-",
80
+ "jd": "-",
81
+ "harmony": "-",
82
+ "qq": "-",
83
+ "lark": "-"
84
+ },
85
+ "quickapp": {
86
+ "huawei": "-",
87
+ "union": "-"
88
+ }
89
+ },
90
+ "uni-app-x": {
91
+ "web": {
92
+ "safari": "-",
93
+ "chrome": "-"
94
+ },
95
+ "app": {
96
+ "android": "-",
97
+ "ios": "-",
98
+ "harmony": "-"
99
+ },
100
+ "mp": {
101
+ "weixin": "-"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }