Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzj-java
uni-app
提交
52382584
U
uni-app
项目概览
wzj-java
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
52382584
编写于
9月 02, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(i18n): mp
上级
5da9c336
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
353 addition
and
29 deletion
+353
-29
packages/uni-cloud/lib/uni.plugin.js
packages/uni-cloud/lib/uni.plugin.js
+2
-2
packages/uni-mp-alipay/build.json
packages/uni-mp-alipay/build.json
+2
-1
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+30
-3
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+13
-1
packages/uni-mp-baidu/build.json
packages/uni-mp-baidu/build.json
+2
-1
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+30
-3
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+13
-1
packages/uni-mp-core/src/api/index.ts
packages/uni-mp-core/src/api/index.ts
+4
-0
packages/uni-mp-core/src/api/locale.ts
packages/uni-mp-core/src/api/locale.ts
+26
-0
packages/uni-mp-core/src/api/promise.ts
packages/uni-mp-core/src/api/promise.ts
+1
-1
packages/uni-mp-core/src/runtime/app.ts
packages/uni-mp-core/src/runtime/app.ts
+15
-1
packages/uni-mp-kuaishou/build.json
packages/uni-mp-kuaishou/build.json
+2
-1
packages/uni-mp-kuaishou/dist/uni.api.esm.js
packages/uni-mp-kuaishou/dist/uni.api.esm.js
+28
-1
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+13
-1
packages/uni-mp-qq/build.json
packages/uni-mp-qq/build.json
+2
-1
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+28
-1
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+13
-1
packages/uni-mp-toutiao/build.json
packages/uni-mp-toutiao/build.json
+2
-1
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+28
-1
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+13
-1
packages/uni-mp-weixin/build.json
packages/uni-mp-weixin/build.json
+2
-1
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+28
-1
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+13
-1
packages/uni-quickapp-webview/build.json
packages/uni-quickapp-webview/build.json
+2
-1
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+28
-1
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+13
-1
未找到文件。
packages/uni-cloud/lib/uni.plugin.js
浏览文件 @
52382584
...
...
@@ -67,7 +67,7 @@ function initUniCloudEnv() {
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
(
uniCloudSpaces
.
map
((
space
)
=>
{
if
(
space
.
clientSecret
)
{
return
{
provider
:
'
aliyun
'
,
provider
:
space
.
provider
||
'
aliyun
'
,
spaceName
:
space
.
name
,
spaceId
:
space
.
id
,
clientSecret
:
space
.
clientSecret
,
...
...
@@ -76,7 +76,7 @@ function initUniCloudEnv() {
}
else
{
return
{
provider
:
'
tencent
'
,
provider
:
space
.
provider
||
'
tencent
'
,
spaceName
:
space
.
name
,
spaceId
:
space
.
id
,
};
...
...
packages/uni-mp-alipay/build.json
浏览文件 @
52382584
...
...
@@ -19,5 +19,6 @@
"__GLOBAL__"
:
"my"
,
"__PLATFORM__"
:
"
\"
mp-alipay
\"
"
,
"__PLATFORM_TITLE__"
:
"支付宝小程序"
}
},
"external"
:
[
"@dcloudio/uni-i18n"
,
"@vue/shared"
,
"vue"
]
}
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
52382584
...
...
@@ -49,8 +49,8 @@ function onAppLaunch(hook) {
my
.
appLaunchHooks
.
push
(
hook
);
}
function
getBaseSystemInfo
()
{
return
my
.
getSystemInfoSync
()
function
getBaseSystemInfo
()
{
return
my
.
getSystemInfoSync
()
}
function
validateProtocolFail
(
name
,
msg
)
{
...
...
@@ -583,7 +583,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
emitter
.
emit
(
name
,
...
args
);
},
EmitProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
SYNC_API_RE
=
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
// Context例外情况
const
CONTEXT_API_RE_EXC
=
[
'
createBLEConnection
'
];
...
...
@@ -727,6 +727,30 @@ function initWrapper(protocols) {
};
}
const
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
});
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
;
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
;
};
const
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
;
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
;
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}));
return
true
;
}
return
false
;
};
const
onLocaleChangeCallbacks
=
[];
const
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
);
}
};
const
baseApis
=
{
$on
,
$off
,
...
...
@@ -736,6 +760,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
52382584
import
{
isPlainObject
,
isArray
,
extend
,
hyphenate
,
isObject
,
hasOwn
,
toNumber
,
capitalize
,
isFunction
,
NOOP
,
EMPTY_OBJ
,
camelize
}
from
'
@vue/shared
'
;
import
{
onUnmounted
,
injectHook
}
from
'
vue
'
;
import
{
onUnmounted
,
injectHook
,
ref
}
from
'
vue
'
;
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -578,6 +578,7 @@ function parseApp(instance, parseAppOptions) {
instance
.
$callHook
(
ON_LAUNCH
,
extend
({
app
:
this
},
options
));
},
};
initLocale
(
instance
);
const
vueOptions
=
instance
.
$
.
type
;
initHooks
(
appOptions
,
HOOKS
);
initUnknownHooks
(
appOptions
,
vueOptions
);
...
...
@@ -594,6 +595,17 @@ function initCreateApp(parseAppOptions) {
return
function
createApp
(
vm
)
{
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
;
},
set
(
v
)
{
locale
.
value
=
v
;
},
});
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
...
...
packages/uni-mp-baidu/build.json
浏览文件 @
52382584
...
...
@@ -19,5 +19,6 @@
"__GLOBAL__"
:
"swan"
,
"__PLATFORM__"
:
"
\"
mp-baidu
\"
"
,
"__PLATFORM_TITLE__"
:
"百度小程序"
}
},
"external"
:
[
"@dcloudio/uni-i18n"
,
"@vue/shared"
,
"vue"
]
}
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
52382584
...
...
@@ -49,8 +49,8 @@ function onAppLaunch(hook) {
swan
.
appLaunchHooks
.
push
(
hook
);
}
function
getBaseSystemInfo
()
{
return
swan
.
getSystemInfoSync
()
function
getBaseSystemInfo
()
{
return
swan
.
getSystemInfoSync
()
}
function
validateProtocolFail
(
name
,
msg
)
{
...
...
@@ -583,7 +583,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
emitter
.
emit
(
name
,
...
args
);
},
EmitProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
SYNC_API_RE
=
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
// Context例外情况
const
CONTEXT_API_RE_EXC
=
[
'
createBLEConnection
'
];
...
...
@@ -727,6 +727,30 @@ function initWrapper(protocols) {
};
}
const
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
});
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
;
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
;
};
const
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
;
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
;
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}));
return
true
;
}
return
false
;
};
const
onLocaleChangeCallbacks
=
[];
const
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
);
}
};
const
baseApis
=
{
$on
,
$off
,
...
...
@@ -736,6 +760,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
52382584
import
{
isPlainObject
,
hasOwn
,
isArray
,
extend
,
hyphenate
,
isObject
,
toNumber
,
isFunction
,
NOOP
,
camelize
}
from
'
@vue/shared
'
;
import
{
onUnmounted
,
injectHook
}
from
'
vue
'
;
import
{
onUnmounted
,
injectHook
,
ref
}
from
'
vue
'
;
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -603,6 +603,7 @@ function parseApp(instance, parseAppOptions) {
instance
.
$callHook
(
ON_LAUNCH
,
extend
({
app
:
this
},
options
));
},
};
initLocale
(
instance
);
const
vueOptions
=
instance
.
$
.
type
;
initHooks
(
appOptions
,
HOOKS
);
initUnknownHooks
(
appOptions
,
vueOptions
);
...
...
@@ -619,6 +620,17 @@ function initCreateApp(parseAppOptions) {
return
function
createApp
(
vm
)
{
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
;
},
set
(
v
)
{
locale
.
value
=
v
;
},
});
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
...
...
packages/uni-mp-core/src/api/index.ts
浏览文件 @
52382584
...
...
@@ -16,6 +16,7 @@ import { initWrapper } from './wrapper'
import
{
MPProtocols
}
from
'
./protocols
'
import
{
onAppLaunch
}
from
'
./hook
'
import
{
getLocale
,
setLocale
,
onLocaleChange
}
from
'
./locale
'
const
baseApis
=
{
$on
,
...
...
@@ -26,6 +27,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
}
export
function
initUni
(
api
:
Record
<
string
,
any
>
,
protocols
:
MPProtocols
)
{
...
...
packages/uni-mp-core/src/api/locale.ts
0 → 100644
浏览文件 @
52382584
export
const
getLocale
:
typeof
uni
.
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
})
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
}
export
const
setLocale
:
typeof
uni
.
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}))
return
true
}
return
false
}
type
OnLocaleCHangeCallback
=
Parameters
<
typeof
uni
.
onLocaleChange
>
[
0
]
const
onLocaleChangeCallbacks
:
OnLocaleCHangeCallback
[]
=
[]
export
const
onLocaleChange
:
typeof
uni
.
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
)
}
}
packages/uni-mp-core/src/api/promise.ts
浏览文件 @
52382584
...
...
@@ -7,7 +7,7 @@ import {
}
from
'
@dcloudio/uni-api/src/helpers/interceptor
'
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
const
CONTEXT_API_RE
=
/^create|Manager$/
...
...
packages/uni-mp-core/src/runtime/app.ts
浏览文件 @
52382584
import
{
extend
}
from
'
@vue/shared
'
import
{
ComponentPublicInstance
,
ComponentOptions
}
from
'
vue
'
import
{
ComponentPublicInstance
,
ComponentOptions
,
ref
}
from
'
vue
'
import
{
initBaseInstance
}
from
'
./componentInstance
'
import
{
initHooks
,
initUnknownHooks
}
from
'
./componentHooks
'
...
...
@@ -65,6 +65,8 @@ function parseApp(
},
}
initLocale
(
instance
)
const
vueOptions
=
instance
.
$
.
type
as
ComponentOptions
initHooks
(
appOptions
,
HOOKS
)
...
...
@@ -87,3 +89,15 @@ export function initCreateApp(parseAppOptions?: ParseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
))
}
}
function
initLocale
(
appVm
:
ComponentPublicInstance
)
{
const
locale
=
ref
<
string
>
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
)
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
},
set
(
v
)
{
locale
.
value
=
v
},
})
}
packages/uni-mp-kuaishou/build.json
浏览文件 @
52382584
...
...
@@ -19,5 +19,6 @@
"__GLOBAL__"
:
"ks"
,
"__PLATFORM__"
:
"
\"
mp-kuaishou
\"
"
,
"__PLATFORM_TITLE__"
:
"快手小程序"
}
},
"external"
:
[
"@dcloudio/uni-i18n"
,
"@vue/shared"
,
"vue"
]
}
packages/uni-mp-kuaishou/dist/uni.api.esm.js
浏览文件 @
52382584
...
...
@@ -583,7 +583,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
emitter
.
emit
(
name
,
...
args
);
},
EmitProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
SYNC_API_RE
=
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
// Context例外情况
const
CONTEXT_API_RE_EXC
=
[
'
createBLEConnection
'
];
...
...
@@ -727,6 +727,30 @@ function initWrapper(protocols) {
};
}
const
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
});
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
;
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
;
};
const
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
;
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
;
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}));
return
true
;
}
return
false
;
};
const
onLocaleChangeCallbacks
=
[];
const
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
);
}
};
const
baseApis
=
{
$on
,
$off
,
...
...
@@ -736,6 +760,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
52382584
import
{
isPlainObject
,
hasOwn
,
isArray
,
extend
,
hyphenate
,
isObject
,
toNumber
,
isFunction
,
NOOP
,
camelize
}
from
'
@vue/shared
'
;
import
{
onUnmounted
,
injectHook
}
from
'
vue
'
;
import
{
onUnmounted
,
injectHook
,
ref
}
from
'
vue
'
;
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -603,6 +603,7 @@ function parseApp(instance, parseAppOptions) {
instance
.
$callHook
(
ON_LAUNCH
,
extend
({
app
:
this
},
options
));
},
};
initLocale
(
instance
);
const
vueOptions
=
instance
.
$
.
type
;
initHooks
(
appOptions
,
HOOKS
);
initUnknownHooks
(
appOptions
,
vueOptions
);
...
...
@@ -619,6 +620,17 @@ function initCreateApp(parseAppOptions) {
return
function
createApp
(
vm
)
{
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
;
},
set
(
v
)
{
locale
.
value
=
v
;
},
});
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
...
...
packages/uni-mp-qq/build.json
浏览文件 @
52382584
...
...
@@ -19,5 +19,6 @@
"__GLOBAL__"
:
"qq"
,
"__PLATFORM__"
:
"
\"
mp-qq
\"
"
,
"__PLATFORM_TITLE__"
:
"QQ小程序"
}
},
"external"
:
[
"@dcloudio/uni-i18n"
,
"@vue/shared"
,
"vue"
]
}
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
52382584
...
...
@@ -583,7 +583,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
emitter
.
emit
(
name
,
...
args
);
},
EmitProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
SYNC_API_RE
=
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
// Context例外情况
const
CONTEXT_API_RE_EXC
=
[
'
createBLEConnection
'
];
...
...
@@ -727,6 +727,30 @@ function initWrapper(protocols) {
};
}
const
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
});
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
;
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
;
};
const
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
;
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
;
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}));
return
true
;
}
return
false
;
};
const
onLocaleChangeCallbacks
=
[];
const
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
);
}
};
const
baseApis
=
{
$on
,
$off
,
...
...
@@ -736,6 +760,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
52382584
import
{
isPlainObject
,
hasOwn
,
isArray
,
extend
,
hyphenate
,
isObject
,
toNumber
,
isFunction
,
NOOP
,
camelize
}
from
'
@vue/shared
'
;
import
{
onUnmounted
,
injectHook
}
from
'
vue
'
;
import
{
onUnmounted
,
injectHook
,
ref
}
from
'
vue
'
;
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -603,6 +603,7 @@ function parseApp(instance, parseAppOptions) {
instance
.
$callHook
(
ON_LAUNCH
,
extend
({
app
:
this
},
options
));
},
};
initLocale
(
instance
);
const
vueOptions
=
instance
.
$
.
type
;
initHooks
(
appOptions
,
HOOKS
);
initUnknownHooks
(
appOptions
,
vueOptions
);
...
...
@@ -619,6 +620,17 @@ function initCreateApp(parseAppOptions) {
return
function
createApp
(
vm
)
{
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
;
},
set
(
v
)
{
locale
.
value
=
v
;
},
});
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
...
...
packages/uni-mp-toutiao/build.json
浏览文件 @
52382584
...
...
@@ -19,5 +19,6 @@
"__GLOBAL__"
:
"tt"
,
"__PLATFORM__"
:
"
\"
mp-toutiao
\"
"
,
"__PLATFORM_TITLE__"
:
"字节跳动小程序"
}
},
"external"
:
[
"@dcloudio/uni-i18n"
,
"@vue/shared"
,
"vue"
]
}
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
52382584
...
...
@@ -583,7 +583,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
emitter
.
emit
(
name
,
...
args
);
},
EmitProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
SYNC_API_RE
=
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
// Context例外情况
const
CONTEXT_API_RE_EXC
=
[
'
createBLEConnection
'
];
...
...
@@ -727,6 +727,30 @@ function initWrapper(protocols) {
};
}
const
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
});
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
;
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
;
};
const
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
;
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
;
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}));
return
true
;
}
return
false
;
};
const
onLocaleChangeCallbacks
=
[];
const
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
);
}
};
const
baseApis
=
{
$on
,
$off
,
...
...
@@ -736,6 +760,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
52382584
import
{
isPlainObject
,
hasOwn
,
isArray
,
extend
,
hyphenate
,
isObject
,
toNumber
,
isFunction
,
NOOP
,
camelize
}
from
'
@vue/shared
'
;
import
{
onUnmounted
,
injectHook
}
from
'
vue
'
;
import
{
onUnmounted
,
injectHook
,
ref
}
from
'
vue
'
;
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -606,6 +606,7 @@ function parseApp(instance, parseAppOptions) {
instance
.
$callHook
(
ON_LAUNCH
,
extend
({
app
:
this
},
options
));
},
};
initLocale
(
instance
);
const
vueOptions
=
instance
.
$
.
type
;
initHooks
(
appOptions
,
HOOKS
);
initUnknownHooks
(
appOptions
,
vueOptions
);
...
...
@@ -622,6 +623,17 @@ function initCreateApp(parseAppOptions) {
return
function
createApp
(
vm
)
{
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
;
},
set
(
v
)
{
locale
.
value
=
v
;
},
});
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
...
...
packages/uni-mp-weixin/build.json
浏览文件 @
52382584
...
...
@@ -19,5 +19,6 @@
"__GLOBAL__"
:
"wx"
,
"__PLATFORM__"
:
"
\"
mp-weixin
\"
"
,
"__PLATFORM_TITLE__"
:
"微信小程序"
}
},
"external"
:
[
"@dcloudio/uni-i18n"
,
"@vue/shared"
,
"vue"
]
}
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
52382584
...
...
@@ -547,7 +547,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
emitter
.
emit
(
name
,
...
args
);
},
EmitProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
SYNC_API_RE
=
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
// Context例外情况
const
CONTEXT_API_RE_EXC
=
[
'
createBLEConnection
'
];
...
...
@@ -691,6 +691,30 @@ function initWrapper(protocols) {
};
}
const
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
});
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
;
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
;
};
const
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
;
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
;
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}));
return
true
;
}
return
false
;
};
const
onLocaleChangeCallbacks
=
[];
const
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
);
}
};
const
baseApis
=
{
$on
,
$off
,
...
...
@@ -700,6 +724,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
52382584
import
{
isPlainObject
,
hasOwn
,
isArray
,
extend
,
hyphenate
,
isObject
,
toNumber
,
isFunction
,
NOOP
,
camelize
}
from
'
@vue/shared
'
;
import
{
onUnmounted
,
injectHook
}
from
'
vue
'
;
import
{
onUnmounted
,
injectHook
,
ref
}
from
'
vue
'
;
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -549,6 +549,7 @@ function parseApp(instance, parseAppOptions) {
instance
.
$callHook
(
ON_LAUNCH
,
extend
({
app
:
this
},
options
));
},
};
initLocale
(
instance
);
const
vueOptions
=
instance
.
$
.
type
;
initHooks
(
appOptions
,
HOOKS
);
initUnknownHooks
(
appOptions
,
vueOptions
);
...
...
@@ -565,6 +566,17 @@ function initCreateApp(parseAppOptions) {
return
function
createApp
(
vm
)
{
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
;
},
set
(
v
)
{
locale
.
value
=
v
;
},
});
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
...
...
packages/uni-quickapp-webview/build.json
浏览文件 @
52382584
...
...
@@ -19,5 +19,6 @@
"__GLOBAL__"
:
"qa"
,
"__PLATFORM__"
:
"
\"
quickapp-webview
\"
"
,
"__PLATFORM_TITLE__"
:
"快应用(Webview)版"
}
},
"external"
:
[
"@dcloudio/uni-i18n"
,
"@vue/shared"
,
"vue"
]
}
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
52382584
...
...
@@ -583,7 +583,7 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
emitter
.
emit
(
name
,
...
args
);
},
EmitProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
SYNC_API_RE
=
/^
\$
|
getLocale|setLocale|
sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
// Context例外情况
const
CONTEXT_API_RE_EXC
=
[
'
createBLEConnection
'
];
...
...
@@ -727,6 +727,30 @@ function initWrapper(protocols) {
};
}
const
getLocale
=
()
=>
{
// 优先使用 $locale
const
app
=
getApp
({
allowDefault
:
true
});
if
(
app
&&
app
.
$vm
)
{
return
app
.
$vm
.
$locale
;
}
return
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
;
};
const
setLocale
=
(
locale
)
=>
{
const
oldLocale
=
getApp
().
$vm
.
$locale
;
if
(
oldLocale
!==
locale
)
{
getApp
().
$vm
.
$locale
=
locale
;
onLocaleChangeCallbacks
.
forEach
((
fn
)
=>
fn
({
locale
}));
return
true
;
}
return
false
;
};
const
onLocaleChangeCallbacks
=
[];
const
onLocaleChange
=
(
fn
)
=>
{
if
(
onLocaleChangeCallbacks
.
indexOf
(
fn
)
===
-
1
)
{
onLocaleChangeCallbacks
.
push
(
fn
);
}
};
const
baseApis
=
{
$on
,
$off
,
...
...
@@ -736,6 +760,9 @@ const baseApis = {
addInterceptor
,
removeInterceptor
,
onAppLaunch
,
getLocale
,
setLocale
,
onLocaleChange
,
};
function
initUni
(
api
,
protocols
)
{
const
wrapper
=
initWrapper
(
protocols
);
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
52382584
import
{
isPlainObject
,
hasOwn
,
isArray
,
extend
,
hyphenate
,
isObject
,
toNumber
,
isFunction
,
NOOP
,
camelize
}
from
'
@vue/shared
'
;
import
{
injectHook
}
from
'
vue
'
;
import
{
injectHook
,
ref
}
from
'
vue
'
;
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
...
...
@@ -534,6 +534,7 @@ function parseApp(instance, parseAppOptions) {
instance
.
$callHook
(
ON_LAUNCH
,
extend
({
app
:
this
},
options
));
},
};
initLocale
(
instance
);
const
vueOptions
=
instance
.
$
.
type
;
initHooks
(
appOptions
,
HOOKS
);
initUnknownHooks
(
appOptions
,
vueOptions
);
...
...
@@ -550,6 +551,17 @@ function initCreateApp(parseAppOptions) {
return
function
createApp
(
vm
)
{
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
uni
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
get
()
{
return
locale
.
value
;
},
set
(
v
)
{
locale
.
value
=
v
;
},
});
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录