@zfqh/uniapp 0.2.8 → 0.2.10
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 +19 -0
- package/lib/hooks/useI18n.js +21 -2
- package/lib/index.js +3 -0
- package/lib/utils/index.d.ts +1 -1
- package/package.json +2 -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.2.10](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.2.9...@zfqh/uniapp@0.2.10) (2026-06-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zfqh/uniapp
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.2.9](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.2.8...@zfqh/uniapp@0.2.9) (2026-06-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* APP国际化不支持动态变量 ([05f49f0](http://10.10.10.16/caoben/front-end/commits/05f49f03ac4a9e5061ac28eec572901b0707e3dd))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.2.8](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.2.7...@zfqh/uniapp@0.2.8) (2026-06-24)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @zfqh/uniapp
|
package/lib/hooks/useI18n.js
CHANGED
|
@@ -2,12 +2,31 @@
|
|
|
2
2
|
import { useI18n as vueUseI18n } from 'vue-i18n';
|
|
3
3
|
// #endif
|
|
4
4
|
let _useI18n;
|
|
5
|
-
// #ifdef APP
|
|
5
|
+
// #ifdef APP
|
|
6
|
+
// APP下不支持动态变量,需要重写
|
|
7
|
+
function replacePlaceholders(str, values) {
|
|
8
|
+
if (!values || typeof str !== 'string') {
|
|
9
|
+
return str;
|
|
10
|
+
}
|
|
11
|
+
let out = str;
|
|
12
|
+
for (const k of Object.keys(values)) {
|
|
13
|
+
out = out.split(`{${k}}`).join(String(values[k]));
|
|
14
|
+
}
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
function t(key, values) {
|
|
18
|
+
const { messages, locale } = uni.$i18n.global;
|
|
19
|
+
const raw = messages[locale]?.[key] || key;
|
|
20
|
+
return replacePlaceholders(raw, values);
|
|
21
|
+
}
|
|
6
22
|
_useI18n = function () {
|
|
23
|
+
if (uni.$i18n.global.t !== t) {
|
|
24
|
+
uni.$i18n.global.t = t;
|
|
25
|
+
}
|
|
7
26
|
return uni.$i18n.global;
|
|
8
27
|
};
|
|
9
28
|
// #endif
|
|
10
|
-
// #ifndef APP
|
|
29
|
+
// #ifndef APP
|
|
11
30
|
_useI18n = vueUseI18n;
|
|
12
31
|
// #endif
|
|
13
32
|
export const useI18n = _useI18n;
|
package/lib/index.js
CHANGED
|
@@ -24,6 +24,9 @@ export { defineConfig, defineEnvConfig } from './configs';
|
|
|
24
24
|
export { default as color } from './configs/color';
|
|
25
25
|
export { cos, toast, navigate, config };
|
|
26
26
|
const install = (app) => {
|
|
27
|
+
if (!uni.$store) {
|
|
28
|
+
uni.$store = app.config.globalProperties.$store;
|
|
29
|
+
}
|
|
27
30
|
// #ifdef MP
|
|
28
31
|
app.mixin(deep);
|
|
29
32
|
// #endif
|
package/lib/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zfqh/uniapp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "uniapp公共模块",
|
|
5
5
|
"author": "yinjiazeng@163.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/qs": "^6.9.16",
|
|
47
47
|
"@types/url-parse": "^1.4.11"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a5025de96bb920ff3d8a94972b1842e21260fafe"
|
|
50
50
|
}
|