@zhaoyifannan/tvue 2.0.13 → 3.1.0
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/LICENSE +1 -1
- package/README.md +1 -2
- package/lib/index.css +1 -1
- package/lib/locale/format.js +1 -4
- package/lib/locale/index.js +6 -7
- package/lib/tvue.js +3420 -2632
- package/lib/tvue.min.js +3 -13
- package/package.json +30 -29
package/lib/locale/format.js
CHANGED
package/lib/locale/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import Vue from 'vue';
|
|
3
1
|
import Format from './format';
|
|
4
2
|
import defaultLang from './lang/zh';
|
|
5
|
-
|
|
3
|
+
import { createApp } from 'vue'
|
|
4
|
+
const Vue = createApp({})
|
|
6
5
|
const format = Format(Vue);
|
|
7
6
|
let lang = defaultLang;
|
|
8
7
|
let merged = false;
|
|
9
|
-
let i18nHandler = function() {
|
|
8
|
+
let i18nHandler = function () {
|
|
10
9
|
const vuei18n = Object.getPrototypeOf(this || Vue || {}).$t;
|
|
11
10
|
if (typeof vuei18n === 'function' && !!Vue.locale) {
|
|
12
11
|
if (!merged) {
|
|
@@ -20,7 +19,7 @@ let i18nHandler = function() {
|
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
export const t = function(path, options) {
|
|
22
|
+
export const t = function (path, options) {
|
|
24
23
|
let value = i18nHandler.apply(this, arguments);
|
|
25
24
|
if (value !== null && value !== undefined) return value;
|
|
26
25
|
|
|
@@ -37,11 +36,11 @@ export const t = function(path, options) {
|
|
|
37
36
|
return '';
|
|
38
37
|
};
|
|
39
38
|
|
|
40
|
-
export const use = function(l) {
|
|
39
|
+
export const use = function (l) {
|
|
41
40
|
lang = l || lang;
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
export const i18n = function(fn) {
|
|
43
|
+
export const i18n = function (fn) {
|
|
45
44
|
i18nHandler = fn || i18nHandler;
|
|
46
45
|
};
|
|
47
46
|
|