Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
陈庄旺
uni-app
提交
9397ccc5
U
uni-app
项目概览
陈庄旺
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9397ccc5
编写于
11月 26, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(i18n): custom locale
上级
11e9b9d7
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
113 addition
and
93 deletion
+113
-93
packages/uni-api/src/service/ui/locale.ts
packages/uni-api/src/service/ui/locale.ts
+4
-0
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+13
-10
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+3
-3
packages/uni-core/src/i18n/component.ts
packages/uni-core/src/i18n/component.ts
+37
-0
packages/uni-core/src/i18n/index.ts
packages/uni-core/src/i18n/index.ts
+1
-1
packages/uni-core/src/i18n/useI18n.ts
packages/uni-core/src/i18n/useI18n.ts
+21
-2
packages/uni-core/src/i18n/utils.ts
packages/uni-core/src/i18n/utils.ts
+5
-39
packages/uni-core/src/service/init/i18n.ts
packages/uni-core/src/service/init/i18n.ts
+0
-12
packages/uni-core/src/service/init/index.ts
packages/uni-core/src/service/init/index.ts
+0
-2
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+8
-12
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+13
-11
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+2
-0
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+2
-0
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+2
-1
packages/uni-shared/src/constants.ts
packages/uni-shared/src/constants.ts
+2
-0
未找到文件。
packages/uni-api/src/service/ui/locale.ts
浏览文件 @
9397ccc5
import
{
useI18n
}
from
'
@dcloudio/uni-core
'
import
{
UNI_STORAGE_LOCALE
}
from
'
@dcloudio/uni-shared
'
import
{
defineOnApi
,
defineSyncApi
}
from
'
../../helpers/api
'
const
API_SET_LOCALE
=
'
setLocale
'
...
...
@@ -40,6 +41,9 @@ export const setLocale = defineSyncApi<typeof uni.setLocale>(
})
weex
.
requireModule
(
'
plus
'
).
setLanguage
(
locale
)
}
if
(
__PLATFORM__
===
'
h5
'
)
{
window
.
localStorage
&&
(
localStorage
[
UNI_STORAGE_LOCALE
]
=
locale
)
}
// 执行 uni.onLocaleChange
UniServiceJSBridge
.
invokeOnCallback
(
API_ON_LOCALE_CHANGE
,
{
locale
})
return
true
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
9397ccc5
...
...
@@ -1617,6 +1617,10 @@ var serviceContext = (function (vue) {
return value.indexOf(delimiters[0]) > -1;
}
const isEnableLocale = once(() => typeof __uniConfig !== 'undefined' &&
__uniConfig.locales &&
!!Object.keys(__uniConfig.locales).length);
let i18n;
function getLocaleMessage() {
const locale = uni.getLocale();
...
...
@@ -1674,6 +1678,15 @@ var serviceContext = (function (vue) {
}
}
i18n = initVueI18n(locale);
// 自定义locales
if (isEnableLocale()) {
const localeKeys = Object.keys(__uniConfig.locales || {});
if (localeKeys.length) {
localeKeys.forEach((locale) => i18n.add(locale, __uniConfig.locales[locale]));
}
// initVueI18n 时 messages 还没有,导致用户自定义 locale 可能不生效,当设置完 messages 后,重新设置 locale
i18n.setLocale(locale);
}
}
return i18n;
}
...
...
@@ -1881,7 +1894,6 @@ var serviceContext = (function (vue) {
}
});
const isEnableLocale = once(() => __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
function initNavigationBarI18n(navigationBar) {
if (isEnableLocale()) {
return defineI18nProperties(navigationBar, [
...
...
@@ -2214,14 +2226,6 @@ var serviceContext = (function (vue) {
invokeViewMethodKeepAlive,
});
function initI18n() {
const localeKeys = Object.keys(__uniConfig.locales || {});
if (localeKeys.length) {
const i18n = useI18n();
localeKeys.forEach((locale) => i18n.add(locale, __uniConfig.locales[locale]));
}
}
function initOn() {
const { on } = UniServiceJSBridge;
on(ON_RESIZE, onResize);
...
...
@@ -2253,7 +2257,6 @@ var serviceContext = (function (vue) {
}
function initService() {
initI18n();
{
initOn();
initSubscribe();
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
9397ccc5
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
packages/uni-core/src/i18n/component.ts
0 → 100644
浏览文件 @
9397ccc5
import
{
defineI18nProperty
,
defineI18nProperties
}
from
'
./useI18n
'
import
{
isEnableLocale
}
from
'
./utils
'
export
function
initNavigationBarI18n
(
navigationBar
:
UniApp
.
PageNavigationBar
|
PlusWebviewWebviewTitleNViewStyles
)
{
if
(
isEnableLocale
())
{
return
defineI18nProperties
(
navigationBar
,
[
[
'
titleText
'
],
[
'
searchInput
'
,
'
placeholder
'
],
])
as
[
boolean
,
boolean
]
}
}
export
function
initPullToRefreshI18n
(
pullToRefresh
:
|
UniApp
.
PageRefreshOptions
|
PlusWebviewWebviewPullToRefreshStyles
)
{
if
(
isEnableLocale
())
{
const
CAPTION
=
'
caption
'
return
defineI18nProperties
(
pullToRefresh
,
[
[
'
contentdown
'
,
CAPTION
],
[
'
contentover
'
,
CAPTION
],
[
'
contentrefresh
'
,
CAPTION
],
])
as
[
boolean
,
boolean
,
boolean
]
}
}
export
function
initTabBarI18n
(
tabBar
:
UniApp
.
TabBarOptions
)
{
if
(
isEnableLocale
()
&&
tabBar
.
list
)
{
tabBar
.
list
.
forEach
((
item
)
=>
{
defineI18nProperty
(
item
,
[
'
text
'
])
})
}
return
tabBar
}
packages/uni-core/src/i18n/index.ts
浏览文件 @
9397ccc5
export
*
from
'
./useI18n
'
export
*
from
'
./messages
'
export
*
from
'
./
utils
'
export
*
from
'
./
component
'
packages/uni-core/src/i18n/useI18n.ts
浏览文件 @
9397ccc5
import
{
isString
}
from
'
@vue/shared
'
import
{
getEnvLocale
,
I18N_JSON_DELIMITERS
}
from
'
@dcloudio/uni-shared
'
import
{
getEnvLocale
,
I18N_JSON_DELIMITERS
,
UNI_STORAGE_LOCALE
,
}
from
'
@dcloudio/uni-shared
'
import
{
BuiltInLocale
,
initVueI18n
,
isI18nStr
}
from
'
@dcloudio/uni-i18n
'
import
{
isEnableLocale
}
from
'
./utils
'
let
i18n
:
ReturnType
<
typeof
initVueI18n
>
...
...
@@ -72,7 +77,9 @@ export function useI18n() {
if
(
__NODE_JS__
)
{
locale
=
getEnvLocale
()
as
BuiltInLocale
}
else
{
locale
=
(
__uniConfig
.
locale
||
navigator
.
language
)
as
BuiltInLocale
locale
=
((
window
.
localStorage
&&
localStorage
[
UNI_STORAGE_LOCALE
])
||
__uniConfig
.
locale
||
navigator
.
language
)
as
BuiltInLocale
}
}
else
if
(
__PLATFORM__
===
'
app
'
)
{
if
(
typeof
getApp
===
'
function
'
)
{
...
...
@@ -86,6 +93,18 @@ export function useI18n() {
locale
=
uni
.
getSystemInfoSync
().
language
as
BuiltInLocale
}
i18n
=
initVueI18n
(
locale
)
// 自定义locales
if
(
isEnableLocale
())
{
const
localeKeys
=
Object
.
keys
(
__uniConfig
.
locales
||
{})
if
(
localeKeys
.
length
)
{
localeKeys
.
forEach
((
locale
)
=>
i18n
.
add
(
locale
as
BuiltInLocale
,
__uniConfig
.
locales
[
locale
])
)
}
// initVueI18n 时 messages 还没有,导致用户自定义 locale 可能不生效,当设置完 messages 后,重新设置 locale
i18n
.
setLocale
(
locale
)
}
}
return
i18n
}
packages/uni-core/src/i18n/utils.ts
浏览文件 @
9397ccc5
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
{
defineI18nProperty
,
defineI18nProperties
}
from
'
./useI18n
'
const
isEnableLocale
=
once
(
()
=>
__uniConfig
.
locales
&&
!!
Object
.
keys
(
__uniConfig
.
locales
).
length
export
const
isEnableLocale
=
once
(
()
=>
typeof
__uniConfig
!==
'
undefined
'
&&
__uniConfig
.
locales
&&
!!
Object
.
keys
(
__uniConfig
.
locales
).
length
)
export
function
initNavigationBarI18n
(
navigationBar
:
UniApp
.
PageNavigationBar
|
PlusWebviewWebviewTitleNViewStyles
)
{
if
(
isEnableLocale
())
{
return
defineI18nProperties
(
navigationBar
,
[
[
'
titleText
'
],
[
'
searchInput
'
,
'
placeholder
'
],
])
as
[
boolean
,
boolean
]
}
}
export
function
initPullToRefreshI18n
(
pullToRefresh
:
|
UniApp
.
PageRefreshOptions
|
PlusWebviewWebviewPullToRefreshStyles
)
{
if
(
isEnableLocale
())
{
const
CAPTION
=
'
caption
'
return
defineI18nProperties
(
pullToRefresh
,
[
[
'
contentdown
'
,
CAPTION
],
[
'
contentover
'
,
CAPTION
],
[
'
contentrefresh
'
,
CAPTION
],
])
as
[
boolean
,
boolean
,
boolean
]
}
}
export
function
initTabBarI18n
(
tabBar
:
UniApp
.
TabBarOptions
)
{
if
(
isEnableLocale
()
&&
tabBar
.
list
)
{
tabBar
.
list
.
forEach
((
item
)
=>
{
defineI18nProperty
(
item
,
[
'
text
'
])
})
}
return
tabBar
}
packages/uni-core/src/service/init/i18n.ts
已删除
100644 → 0
浏览文件 @
11e9b9d7
import
{
BuiltInLocale
}
from
'
@dcloudio/uni-i18n
'
import
{
useI18n
}
from
'
../../i18n
'
export
function
initI18n
()
{
const
localeKeys
=
Object
.
keys
(
__uniConfig
.
locales
||
{})
if
(
localeKeys
.
length
)
{
const
i18n
=
useI18n
()
localeKeys
.
forEach
((
locale
)
=>
i18n
.
add
(
locale
as
BuiltInLocale
,
__uniConfig
.
locales
[
locale
])
)
}
}
packages/uni-core/src/service/init/index.ts
浏览文件 @
9397ccc5
import
{
ComponentPublicInstance
,
ref
}
from
'
vue
'
import
{
useI18n
}
from
'
../../i18n
'
import
{
initI18n
}
from
'
./i18n
'
import
{
initOn
}
from
'
./on
'
import
{
initSubscribe
}
from
'
./subscribe
'
export
function
initService
()
{
initI18n
()
if
(
!
__NODE_JS__
)
{
initOn
()
initSubscribe
()
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
9397ccc5
...
...
@@ -6,6 +6,7 @@ var shared = require("@vue/shared");
var
uniShared
=
require
(
"
@dcloudio/uni-shared
"
);
var
uniI18n
=
require
(
"
@dcloudio/uni-i18n
"
);
var
vueRouter
=
require
(
"
vue-router
"
);
const
isEnableLocale
=
uniShared
.
once
(()
=>
typeof
__uniConfig
!==
"
undefined
"
&&
__uniConfig
.
locales
&&
!!
Object
.
keys
(
__uniConfig
.
locales
).
length
);
let
i18n
;
function
getLocaleMessage
()
{
const
locale
=
uni
.
getLocale
();
...
...
@@ -60,6 +61,13 @@ function useI18n() {
}
}
i18n
=
uniI18n
.
initVueI18n
(
locale
);
if
(
isEnableLocale
())
{
const
localeKeys
=
Object
.
keys
(
__uniConfig
.
locales
||
{});
if
(
localeKeys
.
length
)
{
localeKeys
.
forEach
((
locale2
)
=>
i18n
.
add
(
locale2
,
__uniConfig
.
locales
[
locale2
]));
}
i18n
.
setLocale
(
locale
);
}
}
return
i18n
;
}
...
...
@@ -132,7 +140,6 @@ const initI18nVideoMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
useI18n
().
add
(
uniI18n
.
LOCALE_ZH_HANT
,
normalizeMessages
(
name
,
keys
,
[
"
\
u5F48
\
u5E55
"
,
"
\
u97F3
\
u91CF
"
]),
false
);
}
});
const
isEnableLocale
=
uniShared
.
once
(()
=>
__uniConfig
.
locales
&&
!!
Object
.
keys
(
__uniConfig
.
locales
).
length
);
function
initNavigationBarI18n
(
navigationBar
)
{
if
(
isEnableLocale
())
{
return
defineI18nProperties
(
navigationBar
,
[
...
...
@@ -450,16 +457,6 @@ const ServiceJSBridge = /* @__PURE__ */ shared.extend(initBridge("view"), {
invokeViewMethod
,
invokeViewMethodKeepAlive
});
function
initI18n
()
{
const
localeKeys
=
Object
.
keys
(
__uniConfig
.
locales
||
{});
if
(
localeKeys
.
length
)
{
const
i18n2
=
useI18n
();
localeKeys
.
forEach
((
locale
)
=>
i18n2
.
add
(
locale
,
__uniConfig
.
locales
[
locale
]));
}
}
function
initService
()
{
initI18n
();
}
function
initAppVm
(
appVm2
)
{
appVm2
.
$vm
=
appVm2
;
appVm2
.
$mpType
=
"
app
"
;
...
...
@@ -6901,7 +6898,6 @@ function initApp(vm) {
appVm
=
vm
;
initAppVm
(
appVm
);
appVm
.
globalData
=
appVm
.
$options
.
globalData
||
{};
initService
();
}
function
wrapperComponentSetup
(
comp
,
{
init
,
setup
,
before
})
{
before
&&
before
(
comp
);
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
9397ccc5
import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent, openBlock, createElementBlock, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, createTextVNode, onBeforeActivate, onBeforeDeactivate, createBlock, renderList, onDeactivated, createApp, Transition, effectScope, withCtx, KeepAlive, resolveDynamicComponent, createElementVNode, normalizeStyle, renderSlot } from "vue";
import { isString, extend, stringifyStyle, parseStringStyle, isPlainObject, isFunction, capitalize, camelize, isArray, hasOwn, isObject, toRawType, makeMap as makeMap$1, isPromise, hyphenate, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared";
import {
I18N_JSON_DELIMITERS, once
, passive, initCustomDataset, addLeadingSlash, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, UniLifecycleHooks, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import {
once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS
, passive, initCustomDataset, addLeadingSlash, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, UniLifecycleHooks, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { initVueI18n, isI18nStr, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n";
import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
const isEnableLocale = once(() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
let i18n;
function getLocaleMessage() {
const locale = uni.getLocale();
...
...
@@ -53,10 +54,17 @@ function useI18n() {
let locale;
{
{
locale = __uniConfig.locale || navigator.language;
locale =
window.localStorage && localStorage[UNI_STORAGE_LOCALE] ||
__uniConfig.locale || navigator.language;
}
}
i18n = initVueI18n(locale);
if (isEnableLocale()) {
const localeKeys = Object.keys(__uniConfig.locales || {});
if (localeKeys.length) {
localeKeys.forEach((locale2) => i18n.add(locale2, __uniConfig.locales[locale2]));
}
i18n.setLocale(locale);
}
}
return i18n;
}
...
...
@@ -318,7 +326,6 @@ const initI18nChooseLocationMsgsOnce = /* @__PURE__ */ once(() => {
useI18n().add(LOCALE_ZH_HANT, normalizeMessages(name, keys, ["\u641C\u7D22\u5730\u9EDE", "\u53D6\u6D88"]), false);
}
});
const isEnableLocale = once(() => __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
function initNavigationBarI18n(navigationBar) {
if (isEnableLocale()) {
return defineI18nProperties(navigationBar, [
...
...
@@ -1380,13 +1387,6 @@ const ServiceJSBridge = /* @__PURE__ */ extend(initBridge("view"), {
invokeViewMethod,
invokeViewMethodKeepAlive
});
function initI18n() {
const localeKeys = Object.keys(__uniConfig.locales || {});
if (localeKeys.length) {
const i18n2 = useI18n();
localeKeys.forEach((locale) => i18n2.add(locale, __uniConfig.locales[locale]));
}
}
function initOn() {
const { on: on2 } = UniServiceJSBridge;
on2(ON_RESIZE, onResize$1);
...
...
@@ -1416,7 +1416,6 @@ function createPageEvent(name) {
};
}
function initService() {
initI18n();
{
initOn();
initSubscribe();
...
...
@@ -4453,6 +4452,9 @@ const setLocale = /* @__PURE__ */ defineSyncApi(API_SET_LOCALE, (locale) => {
const oldLocale = app.$vm.$locale;
if (oldLocale !== locale) {
app.$vm.$locale = locale;
{
window.localStorage && (localStorage[UNI_STORAGE_LOCALE] = locale);
}
UniServiceJSBridge.invokeOnCallback(API_ON_LOCALE_CHANGE, { locale });
return true;
}
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
9397ccc5
...
...
@@ -102,6 +102,7 @@ const NAVBAR_HEIGHT = 44;
const
TABBAR_HEIGHT
=
50
;
const
ON_REACH_BOTTOM_DISTANCE
=
50
;
const
RESPONSIVE_MIN_WIDTH
=
768
;
const
UNI_STORAGE_LOCALE
=
'
UNI_LOCALE
'
;
// quickapp-webview 不能使用 default 作为插槽名称
const
SLOT_DEFAULT_NAME
=
'
d
'
;
const
COMPONENT_NAME_PREFIX
=
'
VUni
'
;
...
...
@@ -1276,6 +1277,7 @@ exports.UNI_SSR_DATA = UNI_SSR_DATA;
exports
.
UNI_SSR_GLOBAL_DATA
=
UNI_SSR_GLOBAL_DATA
;
exports
.
UNI_SSR_STORE
=
UNI_SSR_STORE
;
exports
.
UNI_SSR_TITLE
=
UNI_SSR_TITLE
;
exports
.
UNI_STORAGE_LOCALE
=
UNI_STORAGE_LOCALE
;
exports
.
UniBaseNode
=
UniBaseNode
;
exports
.
UniCommentNode
=
UniCommentNode
;
exports
.
UniElement
=
UniElement
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
9397ccc5
...
...
@@ -593,6 +593,8 @@ export declare const UNI_SSR_STORE = "store";
export
declare
const
UNI_SSR_TITLE
=
"
title
"
;
export
declare
const
UNI_STORAGE_LOCALE
=
"
UNI_LOCALE
"
;
export
declare
class
UniBaseNode
extends
UniNode
{
attributes
:
Record
<
string
,
unknown
>
;
style
:
null
|
string
|
Record
<
string
,
string
|
string
[]
>
;
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
9397ccc5
...
...
@@ -98,6 +98,7 @@ const NAVBAR_HEIGHT = 44;
const
TABBAR_HEIGHT
=
50
;
const
ON_REACH_BOTTOM_DISTANCE
=
50
;
const
RESPONSIVE_MIN_WIDTH
=
768
;
const
UNI_STORAGE_LOCALE
=
'
UNI_LOCALE
'
;
// quickapp-webview 不能使用 default 作为插槽名称
const
SLOT_DEFAULT_NAME
=
'
d
'
;
const
COMPONENT_NAME_PREFIX
=
'
VUni
'
;
...
...
@@ -1190,4 +1191,4 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVueTextNode
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatLog
,
getCustomDataset
,
getDataByPath
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDataset
,
invokeArrayFns
,
isAppNativeTag
,
isBuiltInComponent
,
isComponentTag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVueTextNode
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
U
NI_STORAGE_LOCALE
,
U
niBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatLog
,
getCustomDataset
,
getDataByPath
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDataset
,
invokeArrayFns
,
isAppNativeTag
,
isBuiltInComponent
,
isComponentTag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
packages/uni-shared/src/constants.ts
浏览文件 @
9397ccc5
...
...
@@ -4,6 +4,8 @@ export const TABBAR_HEIGHT = 50
export
const
ON_REACH_BOTTOM_DISTANCE
=
50
export
const
RESPONSIVE_MIN_WIDTH
=
768
export
const
UNI_STORAGE_LOCALE
=
'
UNI_LOCALE
'
// quickapp-webview 不能使用 default 作为插槽名称
export
const
SLOT_DEFAULT_NAME
=
'
d
'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录