@zfqh/uview-x 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.
Files changed (43) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +83 -149
  3. package/components/uv-badge/uv-badge.vue +5 -3
  4. package/components/uv-button/uv-button.vue +2 -2
  5. package/components/uv-checkbox/uv-checkbox.vue +0 -3
  6. package/components/uv-checkbox-group/uv-checkbox-group.vue +0 -3
  7. package/components/uv-dialog/uv-dialog.vue +1 -3
  8. package/components/uv-form/uv-form.vue +0 -2
  9. package/components/uv-form-item/uv-form-item.vue +1 -2
  10. package/components/uv-icon/uv-icon.vue +6 -6
  11. package/components/uv-input/uv-input.vue +1 -2
  12. package/components/uv-line-progress/uv-line-progress.vue +0 -2
  13. package/components/uv-loading-icon/uv-loading-icon.vue +1 -2
  14. package/components/uv-overlay/uv-overlay.vue +0 -2
  15. package/components/uv-popup/uv-popup.vue +0 -2
  16. package/components/uv-safe-bottom/uv-safe-bottom.vue +0 -2
  17. package/components/uv-status-bar/uv-status-bar.vue +0 -2
  18. package/components/uv-tabs/uv-tabs.vue +1 -2
  19. package/hooks/useI18n.ts +1 -1
  20. package/index.ts +10 -3
  21. package/locales/{en.ts → en-US.ts} +6 -5
  22. package/locales/es-ES.ts +79 -0
  23. package/locales/fr-FR.ts +79 -0
  24. package/locales/index.ts +166 -169
  25. package/locales/ru-RU.ts +79 -0
  26. package/locales/{zh-Hans.ts → zh-CN.ts} +5 -4
  27. package/locales/zh-TW.ts +79 -0
  28. package/package.json +2 -3
  29. package/styles/common.scss +148 -134
  30. package/styles/index.scss +4 -7
  31. package/styles/reset.scss +25 -0
  32. package/styles/theme.scss +40 -44
  33. package/styles/var.module.scss +1 -1
  34. package/types/index.d.ts +5 -12
  35. package/utils/config.ts +18 -13
  36. package/utils/function.ts +12 -11
  37. package/utils/index.ts +1 -0
  38. package/utils/locale.ts +35 -61
  39. package/utils/scrollbar.ts +181 -0
  40. package/styles/color.scss +0 -33
  41. package/styles/components.scss +0 -19
  42. package/styles/vue.scss +0 -39
  43. package/theme.scss +0 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.0.6](http://10.10.10.16/caoben/front-end-tools/compare/@zfqh/uview-x@0.0.5...@zfqh/uview-x@0.0.6) (2026-11-11)
7
+
8
+ **Note:** Version bump only for package @zfqh/uview-x
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.0.5](http://10.10.10.16/caoben/front-end-tools/compare/@zfqh/uview-x@0.0.4...@zfqh/uview-x@0.0.5) (2026-11-11)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * 国际化问题优化 ([b2dda3c](http://10.10.10.16/caoben/front-end-tools/commits/b2dda3c0b9ff45a42bf777db3bddf6f06c5d7e57))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.0.4](http://10.10.10.16/caoben/front-end-tools/compare/@zfqh/uview-x@0.0.3...@zfqh/uview-x@0.0.4) (2026-11-10)
7
26
 
8
27
  **Note:** Version bump only for package @zfqh/uview-x
package/README.md CHANGED
@@ -1,149 +1,83 @@
1
- # @zfqh/uview-x
2
-
3
- 面向 uni-app x 蒸汽模式(Vapor)与经典 uni-app Vue3 的 UV UI 组件库,由 `@gmcb/uv-ui` fork 并完成多端适配:App 支持 uni-app x 蒸汽模式与经典 nvue,H5 / 微信小程序支持 uni-app x VDOM 与经典 Vue3 VDOM。组件保持 `.vue`,沿用 uv-ui 的 `uv-*` 组件名与主要 API。
4
-
5
- ## 安装
6
-
7
- ```bash
8
- npm i @zfqh/uview-x
9
- ```
10
-
11
- ## 接入
12
-
13
- `main.ts` 注册插件,注册后脚本可用 `uni.$uv`、模板可用 `$uv`:
14
-
15
- ```ts
16
- import { createSSRApp } from 'vue';
17
- import App from './App.uvue';
18
- import uviewX from '@zfqh/uview-x';
19
-
20
- export function createApp() {
21
- const app = createSSRApp(App);
22
- app.use(uviewX as any);
23
- return { app };
24
- }
25
- ```
26
-
27
- `pages.json` 配置 easycom,组件按需自动引入:
28
-
29
- ```json
30
- {
31
- "easycom": {
32
- "autoscan": true,
33
- "custom": {
34
- "^uv-(.*)": "@zfqh/uview-x/components/uv-$1/uv-$1.vue"
35
- }
36
- }
37
- }
38
- ```
39
-
40
- 以上 easycom 配置适用于 dev 阶段(H5 / 小程序 / 经典 uni-app);uni-app x Vapor 的 build 阶段不支持 easycom,见下方显式 import。
41
-
42
- ### 显式 import(推荐;Vapor build 必需)
43
-
44
- uni-app x Vapor(蒸汽模式)下,easycom 仅在 dev 阶段可用,build 阶段不支持;用户也可能主动关闭 easycom。为此 `components/uv-*` 内部已经全部改为显式 import,页面只需 import 自己用到的组件:
45
-
46
- ```vue
47
- <script setup lang="ts">
48
- import UvButton from '@zfqh/uview-x/components/uv-button/uv-button.vue';
49
- import UvIcon from '@zfqh/uview-x/components/uv-icon/uv-icon.vue';
50
- </script>
51
-
52
- <template>
53
- <uv-button type="primary" text="提交" @click="onSubmit" />
54
- <uv-icon name="search" :size="24" />
55
- </template>
56
- ```
57
-
58
- - 组件入口为 `@zfqh/uview-x/components/uv-<name>/uv-<name>.vue`,与 easycom 路径一致。
59
- - `examples/uview-vapor`、`examples/uniapp-vapor` 已关闭 easycom(`"easycom": { "autoscan": false }`),用于验证显式 import 在 dev / build 下都可用。
60
- - `app.use(uviewX)` 只安装 `$uv` 插件能力,不注册组件。
61
-
62
- `uni.scss` 引入主题变量,`App.uvue` 引入全局工具样式:
63
-
64
- ```scss
65
- @import '@zfqh/uview-x/theme.scss';
66
- ```
67
-
68
- ```vue
69
- <style lang="scss">
70
- @import '@zfqh/uview-x/styles/index.scss';
71
- </style>
72
- ```
73
-
74
- App x 需在 `manifest.json` 开启蒸汽模式:`"uni-app-x": { "vapor": true, "styleIsolationVersion": "2", "vapor-default-script-lang": "ts" }`,完整配置见 `examples/uview-vapor/manifest.json`。
75
-
76
- ## 组件示例
77
-
78
- ```vue
79
- <template>
80
- <uv-button type="primary" text="提交" @click="onSubmit" />
81
- <uv-icon name="search" :size="24" />
82
- <uv-line />
83
- </template>
84
- ```
85
-
86
- 已适配组件以 `components/uv-*` 为准。业务对话框 `uv-dialog`(基于 `uv-popup`,`open()` 返回 Promise)示例见 `examples/uview-vapor/pages/feedback/dialog/` 与 `examples/uview-nvue/pages/feedback/dialog/`,完整说明见 `AGENTS.md`。
87
-
88
- ## 工具与 hooks
89
-
90
- 入口同时导出 `hooks`、`utils`、`libs` 的公共 API(`libs` 仅汇总第三方库公共入口),例如:
91
-
92
- ```ts
93
- import { $uv, config, useDebounce, useThrottle, Request, dayjs } from '@zfqh/uview-x';
94
-
95
- config.color.primary;
96
- uni.$uv.config.color.primary; // 同一个对象
97
-
98
- // 组件全局 props;需在组件加载前调用,后续修改不影响已加载组件
99
- uni.$uv.setConfig({
100
- props: {
101
- button: { type: { default: 'primary' } },
102
- input: { color: { default: '#303133' } },
103
- },
104
- });
105
- ```
106
-
107
- ## 国际化
108
-
109
- 组件内置文案(`uv-dialog` / `uv-code` / `uv-form` / `timeFrom`)随包提供 `zh-Hans`、`en` 两套语言包;`createI18n` 会自动合并,用户 `messages` 传同名 key 即可覆盖(键空间 `uv.*`)。
110
-
111
- ```ts
112
- // main.ts:创建 i18n(自动合并组件内置语言包),再安装到 Vue app
113
- import { createI18n } from '@zfqh/uview-x';
114
-
115
- const i18n = createI18n({
116
- legacy: false,
117
- locale: 'zh-Hans',
118
- fallbackLocale: 'zh-Hans',
119
- messages: {
120
- // 只覆盖想自定义的 key,未传的以内置文案兜底
121
- 'zh-Hans': { uv: { dialog: { title: '温馨提示' } } },
122
- en: { uv: { dialog: { title: 'Notice' } } },
123
- },
124
- });
125
-
126
- app.use(i18n);
127
- ```
128
-
129
- ```ts
130
- // 页面内
131
- import { useI18n, setLocale, getLocale } from '@zfqh/uview-x';
132
-
133
- const { t } = useI18n();
134
-
135
- t('uv.dialog.title'); // 未创建实例时也能取到内置文案(自动降级)
136
- setLocale('en'); // 更新实例 + 写入 storage 的 UNI_LOCALE + 调用 uni.setLocale
137
- getLocale(); // 读取当前语言(优先 storage UNI_LOCALE)
138
- ```
139
-
140
- - 公共 API:`createI18n` / `getLocale` / `getLocaleMessage` / `setLocale` + `useI18n`;`useI18n` 在未创建实例时降级读组件内置语言包,不会抛错。
141
- - 内置文案键空间:`uv.dialog.title/cancel/confirm`、`uv.code.start/change/end`、`uv.time.*`、`uv.form.*`(async-validator 校验文案,保留 `%s` 占位符)。
142
- - `uv-dialog` 的 `title` / `cancelText` / `confirmText` 默认 `''` 时取内置文案;隐藏按钮用 `showCancelButton` / `showConfirmButton`(文本只能是 String,不能传 `false`)。
143
- - 完整 API、平台差异与降级规则见 `AGENTS.md` §12.1。
144
-
145
- ## 文档
146
-
147
- - 开发约定、组件 API、平台差异与验证:[AGENTS.md](AGENTS.md)
148
- - 示例工程:`examples/uview-vapor`(蒸汽模式)、`examples/uview-nvue`(nvue)
149
- - 参考:[uni-app x 蒸汽模式](https://doc.dcloud.net.cn/uni-app-x/app-vapor.html) · [uv-ui 官方文档](https://www.uvui.cn)
1
+ # @zfqh/uview-x
2
+
3
+ 面向 uni-app x 蒸汽模式(Vapor)、uni-app x H5 / 微信小程序(VDOM)与经典 uni-app Vue3 / nvue 的 UV UI 组件库,沿用 `uv-*` 组件名与 uv-ui API;入口同时提供 `$uv`、`config`、hooks 与第三方库导出。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm i @zfqh/uview-x
9
+ ```
10
+
11
+ ## 快速开始
12
+
13
+ `main.ts` 注册插件(仅安装 `$uv` 能力,不注册组件):
14
+
15
+ ```ts
16
+ import { createSSRApp } from 'vue';
17
+ import App from './App.uvue';
18
+ import uviewX from '@zfqh/uview-x';
19
+
20
+ export function createApp() {
21
+ const app = createSSRApp(App);
22
+ app.use(uviewX);
23
+ return { app };
24
+ }
25
+ ```
26
+
27
+ 页面推荐显式 import 组件(uni-app x Vapor 构建必需):
28
+
29
+ ```vue
30
+ <script setup lang="ts">
31
+ import UvButton from '@zfqh/uview-x/components/uv-button/uv-button.vue';
32
+ </script>
33
+
34
+ <template>
35
+ <uv-button type="primary" text="提交" />
36
+ </template>
37
+ ```
38
+
39
+ dev 阶段也可使用 easycom(`pages.json`):
40
+
41
+ ```json
42
+ {
43
+ "easycom": {
44
+ "autoscan": true,
45
+ "custom": {
46
+ "^uv-(.*)": "@zfqh/uview-x/components/uv-$1/uv-$1.vue"
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ > uni-app x Vapor 下 easycom 仅在 dev 阶段可用,build 阶段不支持。
53
+
54
+ `uni.scss` 引入主题变量,`App.uvue` / `App.vue` 引入全局样式:
55
+
56
+ ```scss
57
+ @import '@zfqh/uview-x/styles/theme.scss';
58
+ ```
59
+
60
+ ```vue
61
+ <style lang="scss">
62
+ @import '@zfqh/uview-x/styles/index.scss';
63
+ </style>
64
+ ```
65
+
66
+ 全局配置(如 H5 滚动条,默认隐藏)需在 `app.use(uviewX)` 前通过 `uni.$uv.setConfig({ scrollbar: true })` 设置(安装时应用一次),详见 `AGENTS.md`。
67
+
68
+ ## 国际化
69
+
70
+ 默认简体中文;其他语言按需引入并合并(可选:`zh-CN`、`zh-TW`、`en-US`、`es-ES`、`fr-FR`、`ru-RU`):
71
+
72
+ ```ts
73
+ import enUS from '@zfqh/uview-x/locales/en-US';
74
+ // createI18n({ messages: { 'en-US': { ...enUS, ...自定义 } } })
75
+ // 其他语言将路径中的 en-US 换成对应 locale 即可
76
+ ```
77
+
78
+ ## 文档
79
+
80
+ - 开发约定、组件清单、完整 API、平台差异与验证:[AGENTS.md](AGENTS.md)
81
+ - 示例工程:`examples/uview-vapor`(蒸汽模式)、`examples/uview-nvue`(nvue)
82
+ - 变更记录:[CHANGELOG.md](CHANGELOG.md)
83
+ - 参考:[uni-app x 蒸汽模式](https://doc.dcloud.net.cn/uni-app-x/app-vapor.html) · [uv-ui 官方文档](https://www.uvui.cn)
@@ -100,8 +100,7 @@
100
100
  </script>
101
101
 
102
102
  <style lang="scss">
103
- @import '../../styles/components.scss';
104
- @import '../../styles/color.scss';
103
+ @import '../../styles/theme.scss';
105
104
 
106
105
  $uv-badge-primary: $uv-primary !default;
107
106
  $uv-badge-error: $uv-error !default;
@@ -120,7 +119,10 @@
120
119
  border-top-left-radius: $uv-badge-dot-radius;
121
120
  border-bottom-left-radius: $uv-badge-dot-radius;
122
121
  border-bottom-right-radius: $uv-badge-dot-radius;
123
- @include flex;
122
+ /* #ifndef APP-NVUE */
123
+ display: flex;
124
+ /* #endif */
125
+ flex-direction: row;
124
126
  line-height: $uv-badge-text-font-size;
125
127
  text-align: $uv-badge-text-align;
126
128
  font-size: $uv-badge-text-font-size;
@@ -209,7 +209,7 @@
209
209
  return p.type === 'info' ? '#000000' : '#ffffff'
210
210
  })
211
211
 
212
- // uv-ui 主题色(与 styles/color.scss 一致),用于 plain/light 态文字颜色
212
+ // uv-ui 主题色(与 styles/theme.scss 一致),用于 plain/light 态文字颜色
213
213
  const typeTextColors: Record<string, string> = {
214
214
  info: '#909399',
215
215
  primary: '#3c9cff',
@@ -353,7 +353,7 @@
353
353
  </script>
354
354
 
355
355
  <style lang="scss">
356
- @import '../../styles/color.scss';
356
+ @import '../../styles/theme.scss';
357
357
 
358
358
  .uv-button-wrapper {
359
359
  position: relative;
@@ -326,9 +326,6 @@
326
326
  </script>
327
327
 
328
328
  <style lang="scss">
329
- @import '../../styles/components.scss';
330
- @import '../../styles/color.scss';
331
-
332
329
  $uv-checkbox-label-wrap-padding-right: 6px !default;
333
330
  $uv-checkbox-icon-wrap-font-size: 6px !default;
334
331
  $uv-checkbox-icon-wrap-border-width: 1px !default;
@@ -143,9 +143,6 @@
143
143
  </script>
144
144
 
145
145
  <style lang="scss">
146
- @import '../../styles/components.scss';
147
- @import '../../styles/color.scss';
148
-
149
146
  .uv-checkbox-group {
150
147
  flex: 1;
151
148
  }
@@ -111,7 +111,7 @@
111
111
  /**
112
112
  * Dialog 业务对话框
113
113
  * @description 基于 uv-popup 的业务对话框:标题/内容/底部取消确认/关闭/确认回调,支持 ref.open() 返回 Promise;
114
- * 标题与按钮内置文案支持 i18n(内置 zh-Hans / en,可通过 createI18n messages 覆盖 uv.dialog.*)
114
+ * 标题与按钮内置文案支持 i18n(默认中文;其他语言需显式引入语言包并在 createI18n 中合并,可覆盖 uv.dialog.*)
115
115
  * @tutorial https://www.uvui.cn/components/popup.html
116
116
  * @property {Boolean} modelValue 是否显示(v-model)
117
117
  * @property {String} mode 弹出方式,默认 center
@@ -440,8 +440,6 @@
440
440
  </script>
441
441
 
442
442
  <style lang="scss">
443
- @import '../../styles/color.scss';
444
-
445
443
  .uv-dialog {
446
444
  /* #ifndef APP-NVUE */
447
445
  box-sizing: border-box;
@@ -247,8 +247,6 @@
247
247
  </script>
248
248
 
249
249
  <style lang="scss">
250
- @import '../../styles/components.scss';
251
-
252
250
  .uv-form {
253
251
  display: flex;
254
252
  flex-direction: column;
@@ -230,8 +230,7 @@
230
230
  </script>
231
231
 
232
232
  <style lang="scss">
233
- @import '../../styles/components.scss';
234
- @import '../../styles/color.scss';
233
+ @import '../../styles/theme.scss';
235
234
 
236
235
  .uv-form-item {
237
236
  display: flex;
@@ -118,11 +118,11 @@ const iconStyle = computed(() => {
118
118
  };
119
119
  if (p.color && !colorType.includes(p.color)) {
120
120
  style.color = p.color;
121
- }
122
- if (p.customPrefix !== 'uvicon') {
123
- style.fontFamily = p.customPrefix;
124
- } else {
125
- style.fontFamily = 'uvicon-iconfont';
121
+ }
122
+ if (p.customPrefix !== 'uvicon') {
123
+ style.fontFamily = p.customPrefix;
124
+ } else {
125
+ style.fontFamily = 'uvicon-iconfont';
126
126
  }
127
127
  return style;
128
128
  });
@@ -141,7 +141,7 @@ const clickHandler = (e: any) => {
141
141
  </script>
142
142
 
143
143
  <style lang="scss">
144
- @import '../../styles/color.scss';
144
+ @import '../../styles/theme.scss';
145
145
 
146
146
  /* #ifndef APP-NVUE */
147
147
  @font-face {
@@ -377,8 +377,7 @@
377
377
  </script>
378
378
 
379
379
  <style lang="scss">
380
- @import '../../styles/components.scss';
381
- @import '../../styles/color.scss';
380
+ @import '../../styles/theme.scss';
382
381
 
383
382
  .uv-input {
384
383
  /* #ifndef APP-NVUE */
@@ -108,8 +108,6 @@
108
108
  </script>
109
109
 
110
110
  <style lang="scss">
111
- @import '../../styles/components.scss';
112
-
113
111
  .uv-line-progress {
114
112
  /* #ifndef APP-NVUE */
115
113
  display: flex;
@@ -160,8 +160,7 @@
160
160
  </script>
161
161
 
162
162
  <style lang="scss">
163
- @import '../../styles/components.scss';
164
- @import '../../styles/color.scss';
163
+ @import '../../styles/theme.scss';
165
164
 
166
165
  .uv-loading-icon {
167
166
  display: flex;
@@ -104,8 +104,6 @@
104
104
  </script>
105
105
 
106
106
  <style lang="scss">
107
- @import '../../styles/components.scss';
108
-
109
107
  $uv-overlay-top: 0 !default;
110
108
  $uv-overlay-left: 0 !default;
111
109
  $uv-overlay-background-color: rgba(0, 0, 0, 0.7) !default;
@@ -325,8 +325,6 @@
325
325
  </script>
326
326
 
327
327
  <style lang="scss">
328
- @import '../../styles/components.scss';
329
-
330
328
  .uv-popup {
331
329
  position: fixed;
332
330
  /* #ifndef APP-NVUE */
@@ -96,8 +96,6 @@
96
96
  </script>
97
97
 
98
98
  <style lang="scss">
99
- @import '../../styles/components.scss';
100
-
101
99
  .uv-safe-bottom {
102
100
  /* #ifndef APP-NVUE */
103
101
  width: 100%;
@@ -102,8 +102,6 @@
102
102
  </script>
103
103
 
104
104
  <style lang="scss">
105
- @import '../../styles/components.scss';
106
-
107
105
  .uv-status-bar {
108
106
  /* #ifndef APP-NVUE */
109
107
  width: 100%;
@@ -359,8 +359,7 @@
359
359
  </script>
360
360
 
361
361
  <style lang="scss">
362
- @import '../../styles/components.scss';
363
- @import '../../styles/color.scss';
362
+ @import '../../styles/theme.scss';
364
363
 
365
364
  .uv-tabs {
366
365
  display: flex;
package/hooks/useI18n.ts CHANGED
@@ -46,7 +46,7 @@ function createLocaleComputed(): WritableComputedRef<string> {
46
46
  }
47
47
 
48
48
  /**
49
- * 降级实现:不依赖 vue-i18n 运行时,直接读 `uni.$i18n` 语言包 + 组件内置语言包。
49
+ * 降级实现:不依赖 vue-i18n 运行时,直接读 `uni.$i18n` 语言包 + 默认中文语言包。
50
50
  *
51
51
  * 小程序端 vue-i18n 为 runtime-only 构建(无消息编译器),App 端也不依赖 vue-i18n 注入;
52
52
  * H5 未创建 / 未安装 i18n 实例时同样走这里,保证 `useI18n()` 不抛错。
package/index.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { App } from 'vue';
2
2
  import { $uv } from './utils';
3
+ // #ifdef WEB || H5
4
+ import { applyScrollbar } from './utils/scrollbar';
5
+ // #endif
3
6
 
4
7
  export * from './utils';
5
8
  export * from './hooks';
@@ -14,10 +17,14 @@ uni.$uv = $uv;
14
17
  *
15
18
  * - 仅挂到 `app.config.globalProperties.$uv`,模板中可直接使用 `$uv`;
16
19
  * - `uni.$uv` 已在入口模块顶层赋值(脚本中使用);
17
- * - 不注册全局 mixin,也不提供 uv-ui 的 `mpShare` 等安装选项。
18
- */
20
+ * - H5 下按 `config.scrollbar` 注入全局滚动条样式(默认隐藏);
21
+ */
22
+
19
23
  function install(app: App): void {
20
- app.config.globalProperties.$uv = $uv;
24
+ app.config.globalProperties.$uv = $uv;
25
+ // #ifdef WEB || H5
26
+ applyScrollbar($uv.config.scrollbar);
27
+ // #endif
21
28
  }
22
29
 
23
30
  export default { install };
@@ -1,10 +1,11 @@
1
1
  /**
2
- * uview-x 组件内置语言包:英文(en)。
2
+ * uview-x 可选组件语言包:英文(en-US)。
3
3
  *
4
- * 键空间固定为 `uv.*`,用户可通过 `createI18n({ messages })` 传同名 key 覆盖;
5
- * `uv.form.*` 与 async-validator 默认 messages 完全对齐,`%s` 占位符由校验器替换。
4
+ * 不参与内部聚合、不会被 `createI18n` 自动合并;需要英文时由使用方显式引入并合并:
5
+ * `import enUS from '@zfqh/uview-x/locales/en-US'`,再在 `createI18n({ messages: { 'en-US': enUS } })` 中使用。
6
+ * 键空间固定为 `uv.*`,`uv.form.*` 与 async-validator 默认 messages 完全对齐,`%s` 占位符由校验器替换。
6
7
  */
7
- const en = {
8
+ const enUS = {
8
9
  uv: {
9
10
  dialog: {
10
11
  title: 'Tips',
@@ -75,4 +76,4 @@ const en = {
75
76
  },
76
77
  };
77
78
 
78
- export default en;
79
+ export default enUS;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * uview-x 可选组件语言包:西班牙语(es-ES)。
3
+ *
4
+ * 不参与内部聚合、不会被 `createI18n` 自动合并;需要西班牙语时由使用方显式引入并合并:
5
+ * `import esES from '@zfqh/uview-x/locales/es-ES'`,再在 `createI18n({ messages: { 'es-ES': esES } })` 中使用。
6
+ * 键空间固定为 `uv.*`,`uv.form.*` 与 async-validator 默认 messages 完全对齐,`%s` 占位符由校验器替换。
7
+ */
8
+ const esES = {
9
+ uv: {
10
+ dialog: {
11
+ title: 'Consejo',
12
+ cancel: 'Cancelar',
13
+ confirm: 'Confirmar',
14
+ },
15
+ code: {
16
+ start: 'Obtener código',
17
+ // 组件会把 x / X 替换为剩余秒数
18
+ change: 'X segundos para reenviar',
19
+ end: 'Reenviar',
20
+ },
21
+ time: {
22
+ justNow: 'Ahora mismo',
23
+ minutesAgo: 'hace {n} minutos',
24
+ hoursAgo: 'hace {n} horas',
25
+ daysAgo: 'hace {n} días',
26
+ monthsAgo: 'hace {n} meses',
27
+ yearsAgo: 'hace {n} años',
28
+ },
29
+ form: {
30
+ default: 'Error de validación en el campo %s',
31
+ required: '%s es obligatorio',
32
+ enum: '%s debe ser uno de %s',
33
+ whitespace: '%s no puede estar vacío',
34
+ date: {
35
+ format: '%s la fecha %s no es válida para el formato %s',
36
+ parse: '%s no se pudo analizar la fecha, %s no es válido',
37
+ invalid: '%s la fecha %s no es válida',
38
+ },
39
+ types: {
40
+ string: '%s no es de tipo %s',
41
+ method: '%s no es de tipo %s (función)',
42
+ array: '%s no es de tipo %s',
43
+ object: '%s no es de tipo %s',
44
+ number: '%s no es de tipo %s',
45
+ date: '%s no es de tipo %s',
46
+ boolean: '%s no es de tipo %s',
47
+ integer: '%s no es de tipo %s',
48
+ float: '%s no es de tipo %s',
49
+ regexp: '%s no es un %s válido',
50
+ email: '%s no es un %s válido',
51
+ url: '%s no es un %s válido',
52
+ hex: '%s no es un %s válido',
53
+ },
54
+ string: {
55
+ len: '%s debe tener exactamente %s caracteres',
56
+ min: '%s debe tener al menos %s caracteres',
57
+ max: '%s no puede tener más de %s caracteres',
58
+ range: '%s debe tener entre %s y %s caracteres',
59
+ },
60
+ number: {
61
+ len: '%s debe ser igual a %s',
62
+ min: '%s no puede ser menor que %s',
63
+ max: '%s no puede ser mayor que %s',
64
+ range: '%s debe estar entre %s y %s',
65
+ },
66
+ array: {
67
+ len: '%s debe tener exactamente %s elementos',
68
+ min: '%s no puede tener menos de %s elementos',
69
+ max: '%s no puede tener más de %s elementos',
70
+ range: '%s debe tener entre %s y %s elementos',
71
+ },
72
+ pattern: {
73
+ mismatch: '%s el valor %s no coincide con el patrón %s',
74
+ },
75
+ },
76
+ },
77
+ };
78
+
79
+ export default esES;