uview-pro 0.6.12 → 0.6.14

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,13 +1,43 @@
1
- ## 0.6.12(2026-07-24
1
+ ## 0.6.14(2026-07-30
2
2
 
3
3
  ### 🐛 Bug Fixes | Bug 修复
4
4
 
5
- - **vite:** 修复vite插件root根组件在使用npm方式引入时导致无法被正确加载的问题 ([90561fa](https://github.com/anyup/uView-Pro/commit/90561fa406a8c9d8d49f8223cdda333cc662a42a))
5
+ - **uni-root:** 适配HBuilderX环境,添加parser降级逻辑 ([f70749d](https://github.com/anyup/uView-Pro/commit/f70749d14d8e67f44ee44707c6c185b6a06e4b7e))
6
+ - **plugin:** 解决微信小程序平台Vite/Rollup的sourcemap不正确警告问题 ([8158f79](https://github.com/anyup/uView-Pro/commit/8158f79223a6d73b7a715e288c812432081c3b70))
7
+
8
+ ### ♻️ Code Refactoring | 代码重构
9
+
10
+ - **types:** 优化uview-pro的类型声明和导出配置 ([f540d45](https://github.com/anyup/uView-Pro/commit/f540d45fc5bf1ba340138699872d8f97857656fb))
11
+
12
+ ### ✨ Features | 新功能
13
+
14
+ - **root:** root根组件新增生命周期钩子和日志 ([d144b24](https://github.com/anyup/uView-Pro/commit/d144b2432402955e6973628d4dddaa2697f6f901))
6
15
 
7
16
  ### 👥 Contributors
8
17
 
9
18
  <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
10
19
 
20
+ ## 0.6.13(2026-07-28)
21
+
22
+ ### 🐛 Bug Fixes | Bug 修复
23
+
24
+ - **u-picker:** 修复抖音小程序等平台picker数据加载,导致弹窗失败问题(#174) ([ead3cdc](https://github.com/anyup/uView-Pro/commit/ead3cdc18fc5be05a3022acac4485fc3e3e75faa))
25
+ - **u-select:** 修复抖音小程序select弹出问题(#174) ([c7a4c28](https://github.com/anyup/uView-Pro/commit/c7a4c2856f9790747ec234b0a6cc1154b560d701))
26
+
27
+ ### 👥 Contributors
28
+
29
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
30
+
31
+ ## 0.6.12(2026-07-24)
32
+
33
+ ### 🐛 Bug Fixes | Bug 修复
34
+
35
+ - **vite:** 修复vite插件root根组件在使用npm方式引入时导致无法被正确加载的问题 ([90561fa](https://github.com/anyup/uView-Pro/commit/90561fa406a8c9d8d49f8223cdda333cc662a42a))
36
+
37
+ ### 👥 Contributors
38
+
39
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
40
+
11
41
  ## 0.6.11(2026-07-24)
12
42
 
13
43
  ### ✨ Features | 新功能
@@ -305,12 +305,12 @@ watch(
305
305
  if (props.modelValue) {
306
306
  // reinit while open
307
307
  readyToRender.value = false;
308
- await nextTick();
308
+ init();
309
+ readyToRender.value = true;
309
310
  // #ifdef APP-PLUS
311
+ await nextTick();
310
312
  await new Promise(resolve => setTimeout(resolve, 20));
311
313
  // #endif
312
- await init();
313
- readyToRender.value = true;
314
314
  }
315
315
  }
316
316
  },
@@ -324,12 +324,12 @@ watch(
324
324
  savedDefaultTime.value = n || null;
325
325
  if (props.modelValue) {
326
326
  readyToRender.value = false;
327
- await nextTick();
327
+ init();
328
+ readyToRender.value = true;
328
329
  // #ifdef APP-PLUS
330
+ await nextTick();
329
331
  await new Promise(resolve => setTimeout(resolve, 20));
330
332
  // #endif
331
- await init();
332
- readyToRender.value = true;
333
333
  }
334
334
  }
335
335
  }
@@ -342,12 +342,12 @@ watch(
342
342
  savedDefaultRegion.value = n && (n as any[]).length ? (n as any[]).slice() : null;
343
343
  if (props.modelValue) {
344
344
  readyToRender.value = false;
345
- await nextTick();
345
+ init();
346
+ readyToRender.value = true;
346
347
  // #ifdef APP-PLUS
348
+ await nextTick();
347
349
  await new Promise(resolve => setTimeout(resolve, 20));
348
350
  // #endif
349
- await init();
350
- readyToRender.value = true;
351
351
  }
352
352
  }
353
353
  },
@@ -369,15 +369,15 @@ watch(
369
369
  () => props.modelValue,
370
370
  async n => {
371
371
  if (n) {
372
- // 等待一次 DOM 更新
373
- await nextTick();
374
- // APP-PLUS 原生控件可能需要更长的原生初始化时间,先短延迟以提高稳定性
372
+ // 同步调用 init(),确保 picker-view 列数据在渲染前就填充完毕
373
+ // 这对抖音等小程序平台至关重要:原生 picker-view 需要在创建时就有完整数据
374
+ init();
375
+ readyToRender.value = true;
376
+ // APP-PLUS 原生控件可能需要更长的原生初始化时间
375
377
  // #ifdef APP-PLUS
378
+ await nextTick();
376
379
  await new Promise(resolve => setTimeout(resolve, 20));
377
380
  // #endif
378
- // 初始化数据并在完成后再渲染 picker-view
379
- await init();
380
- readyToRender.value = true;
381
381
  } else {
382
382
  // 关闭时隐藏 picker,保留已保存的值
383
383
  readyToRender.value = false;
@@ -461,7 +461,7 @@ function initTimeValue() {
461
461
  /**
462
462
  * 初始化picker各列数据
463
463
  */
464
- async function init() {
464
+ function init() {
465
465
  valueArr.value = [];
466
466
  if (props.mode == 'time') {
467
467
  initTimeValue();
@@ -509,8 +509,6 @@ async function init() {
509
509
  valueArr.value = getEffectiveDefaultSelector();
510
510
  multiSelectorValue.value = getEffectiveDefaultSelector();
511
511
  }
512
- // 等待 DOM 与 Vue 响应式更新完成,确保在原生组件挂载时数据已就绪
513
- await nextTick();
514
512
  }
515
513
  /**
516
514
  * 设置年份列
@@ -119,6 +119,7 @@ const defaultSelector = ref<number[]>([0]);
119
119
  // picker-view的数据
120
120
  const columnData = ref<SelectListItem[][]>([]);
121
121
  // 控制 picker 是否渲染(等待初始化完成)
122
+ // 初始为 false,确保 picker-view 原生组件在数据就绪后才创建(抖音小程序等平台需要在创建时就有完整数据)
122
123
  const readyToRender = ref(false);
123
124
  // 保存用户上次确认的索引,如果用户未确认过,则为 null,首次打开会使用 props.defaultValue
124
125
  const savedSelector = ref<number[] | null>(
@@ -148,17 +149,17 @@ watch(
148
149
  () => props.modelValue,
149
150
  async val => {
150
151
  if (val) {
151
- // 等待一次 DOM 更新
152
- await nextTick();
152
+ // 同步调用 init(),确保 columnData 在 picker-view 渲染前就填充完毕
153
+ // 这对抖音等小程序平台至关重要:原生 picker-view 需要在创建时就有完整数据
154
+ init();
155
+ readyToRender.value = true;
153
156
  // 在 App(APP-PLUS)平台上,原生 picker 可能需要更长时间初始化
154
- // 我们先执行 init,并在 init 完成后将 readyToRender 置为 true,保证 picker 在数据就绪后渲染
155
157
  // #ifdef APP-PLUS
158
+ await nextTick();
156
159
  await new Promise(resolve => setTimeout(resolve, 20));
157
160
  // #endif
158
- init();
159
- readyToRender.value = true;
160
161
  } else {
161
- // 关闭弹窗时复位
162
+ // 关闭弹窗时复位,下次打开时 picker-view 会重新创建,确保数据刷新
162
163
  readyToRender.value = false;
163
164
  }
164
165
  },
package/index.ts CHANGED
@@ -1,100 +1,100 @@
1
- import { $u, type RequestOptions, initTheme, configProvider } from './libs';
2
- import type { UViewProOptions, Theme } from './types/global';
3
- import { defaultThemes } from './libs/config/theme-tokens';
4
- import { setConfig } from './libs/config/config';
5
-
6
- declare const uni: {
7
- [key: string]: any;
8
- $u?: typeof $u;
9
- createSelectorQuery: () => any;
10
- hideLoading: () => void;
11
- showLoading: (options: any) => void;
12
- request: (options: RequestOptions) => any;
13
- };
14
-
15
- // $u挂载到uni对象上
16
- const install = (app: any, options?: UViewProOptions): void => {
17
- try {
18
- if (options) {
19
- // 配置主题:统一使用 useTheme 的 initTheme 初始化,避免重复初始化
20
- if (options?.theme) {
21
- const optTheme = options.theme as any;
22
- // 1.如果是数组,则为多主题配置
23
- if (Array.isArray(optTheme)) {
24
- initTheme(optTheme);
25
- } else if (typeof optTheme === 'object' && optTheme.themes) {
26
- // 2.如果为对象且有themes,则为多主题配置+设置默认主题
27
- initTheme(
28
- optTheme.themes,
29
- {
30
- defaultTheme: optTheme.defaultTheme,
31
- defaultDarkMode: optTheme.defaultDarkMode
32
- },
33
- optTheme.isForce
34
- );
35
- } else {
36
- // 3.兼容之前只有一套样式的情况,需要覆盖默认主题,默认系统主题(uviewpro)
37
- const defaultTheme = defaultThemes[0];
38
- if (defaultTheme) {
39
- // 创建新主题对象,用用户的 theme 覆盖默认主题的 color
40
- const mergedTheme: Theme = {
41
- ...defaultTheme,
42
- color: {
43
- ...defaultTheme.color,
44
- ...optTheme
45
- }
46
- };
47
- // 初始化主题(只包含覆盖后的默认主题)
48
- initTheme([mergedTheme], defaultTheme.name);
49
- }
50
- }
51
- } else {
52
- // 默认初始化系统主题
53
- initTheme();
54
- }
55
- // 初始化国际化(如果提供 options.locale 或使用内置语言包)
56
- try {
57
- // options.locale 可以是 string(默认语言名) | any[](locale 列表) | { locales: any[], defaultLocale?: string }
58
- if (options?.locale) {
59
- const optLocale: any = options.locale as any;
60
- if (typeof optLocale === 'string') {
61
- configProvider.initLocales(undefined, optLocale);
62
- } else if (Array.isArray(optLocale)) {
63
- configProvider.initLocales(optLocale);
64
- } else if (optLocale && typeof optLocale === 'object') {
65
- configProvider.initLocales(optLocale.locales, optLocale.defaultLocale, optLocale.isForce);
66
- } else {
67
- configProvider.initLocales();
68
- }
69
- } else {
70
- // 无 locale 配置,仍然初始化内置语言包以保证可用
71
- configProvider.initLocales();
72
- }
73
- } catch (e) {
74
- console.error('[install locales] Error:', e);
75
- }
76
- // 设置调试模式
77
- setConfig({
78
- debugMode: options?.debugMode ?? false
79
- });
80
- } else {
81
- // 默认初始化系统主题
82
- initTheme();
83
- // 默认初始化内置语言包以保证可用
84
- configProvider.initLocales();
85
- }
86
- } catch (error) {
87
- console.error('[install options] Error:', error);
88
- }
89
- uni.$u = $u;
90
- // 可扩展更多配置项
91
- app.config.globalProperties.$u = $u;
92
- };
93
-
94
- export default {
95
- install
96
- };
97
-
98
- export * from './libs';
99
-
100
- export type { UViewProOptions };
1
+ import { $u, type RequestOptions, initTheme, configProvider } from './libs';
2
+ import type { UViewProOptions, Theme } from './types/global';
3
+ import { defaultThemes } from './libs/config/theme-tokens';
4
+ import { setConfig } from './libs/config/config';
5
+
6
+ declare const uni: {
7
+ [key: string]: any;
8
+ $u?: typeof $u;
9
+ createSelectorQuery: () => any;
10
+ hideLoading: () => void;
11
+ showLoading: (options: any) => void;
12
+ request: (options: RequestOptions) => any;
13
+ };
14
+
15
+ // $u挂载到uni对象上
16
+ const install = (app: any, options?: UViewProOptions): void => {
17
+ try {
18
+ if (options) {
19
+ // 配置主题:统一使用 useTheme 的 initTheme 初始化,避免重复初始化
20
+ if (options?.theme) {
21
+ const optTheme = options.theme as any;
22
+ // 1.如果是数组,则为多主题配置
23
+ if (Array.isArray(optTheme)) {
24
+ initTheme(optTheme);
25
+ } else if (typeof optTheme === 'object' && optTheme.themes) {
26
+ // 2.如果为对象且有themes,则为多主题配置+设置默认主题
27
+ initTheme(
28
+ optTheme.themes,
29
+ {
30
+ defaultTheme: optTheme.defaultTheme,
31
+ defaultDarkMode: optTheme.defaultDarkMode
32
+ },
33
+ optTheme.isForce
34
+ );
35
+ } else {
36
+ // 3.兼容之前只有一套样式的情况,需要覆盖默认主题,默认系统主题(uviewpro)
37
+ const defaultTheme = defaultThemes[0];
38
+ if (defaultTheme) {
39
+ // 创建新主题对象,用用户的 theme 覆盖默认主题的 color
40
+ const mergedTheme: Theme = {
41
+ ...defaultTheme,
42
+ color: {
43
+ ...defaultTheme.color,
44
+ ...optTheme
45
+ }
46
+ };
47
+ // 初始化主题(只包含覆盖后的默认主题)
48
+ initTheme([mergedTheme], defaultTheme.name);
49
+ }
50
+ }
51
+ } else {
52
+ // 默认初始化系统主题
53
+ initTheme();
54
+ }
55
+ // 初始化国际化(如果提供 options.locale 或使用内置语言包)
56
+ try {
57
+ // options.locale 可以是 string(默认语言名) | any[](locale 列表) | { locales: any[], defaultLocale?: string }
58
+ if (options?.locale) {
59
+ const optLocale: any = options.locale as any;
60
+ if (typeof optLocale === 'string') {
61
+ configProvider.initLocales(undefined, optLocale);
62
+ } else if (Array.isArray(optLocale)) {
63
+ configProvider.initLocales(optLocale);
64
+ } else if (optLocale && typeof optLocale === 'object') {
65
+ configProvider.initLocales(optLocale.locales, optLocale.defaultLocale, optLocale.isForce);
66
+ } else {
67
+ configProvider.initLocales();
68
+ }
69
+ } else {
70
+ // 无 locale 配置,仍然初始化内置语言包以保证可用
71
+ configProvider.initLocales();
72
+ }
73
+ } catch (e) {
74
+ console.error('[install locales] Error:', e);
75
+ }
76
+ // 设置调试模式
77
+ setConfig({
78
+ debugMode: options?.debugMode ?? false
79
+ });
80
+ } else {
81
+ // 默认初始化系统主题
82
+ initTheme();
83
+ // 默认初始化内置语言包以保证可用
84
+ configProvider.initLocales();
85
+ }
86
+ } catch (error) {
87
+ console.error('[install options] Error:', error);
88
+ }
89
+ uni.$u = $u;
90
+ // 可扩展更多配置项
91
+ app.config.globalProperties.$u = $u;
92
+ };
93
+
94
+ export default {
95
+ install
96
+ };
97
+
98
+ export * from './libs';
99
+
100
+ export type { UViewProOptions };
package/package.json CHANGED
@@ -2,21 +2,12 @@
2
2
  "id": "uview-pro",
3
3
  "name": "uview-pro",
4
4
  "displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的高质量UI组件库,支持多主题、暗黑模式、多语言",
5
- "version": "0.6.12",
5
+ "version": "0.6.14",
6
6
  "description": "uView Pro是基于Vue3+TS的多平台UI框架,提供80+高质量组件、便捷工具和常用模板,支持多主题、暗黑模式、多语言,支持H5/APP/鸿蒙/小程序多端开发。已在鸿蒙应用商店上架,欢迎体验!",
7
7
  "main": "index.ts",
8
8
  "module": "index.ts",
9
9
  "browser": "index.ts",
10
- "exports": {
11
- ".": "./index.ts",
12
- "./plugins": {
13
- "types": "./plugins/index.ts",
14
- "import": "./plugins/index.mjs",
15
- "require": "./plugins/index.cjs",
16
- "default": "./plugins/index.mjs"
17
- },
18
- "./*": "./*"
19
- },
10
+ "types": "index.ts",
20
11
  "keywords": [
21
12
  "uview-pro",
22
13
  "vue3",