Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzb_79
uni-app
提交
36b699b3
U
uni-app
项目概览
lzb_79
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
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,发现更多精彩内容 >>
提交
36b699b3
编写于
8月 31, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(i18n): tabBar
上级
894e0d3b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
29 deletion
+47
-29
packages/uni-app-vite/src/plugins/mainJs.ts
packages/uni-app-vite/src/plugins/mainJs.ts
+2
-2
packages/uni-cli-shared/src/json/app/manifest/i18n.ts
packages/uni-cli-shared/src/json/app/manifest/i18n.ts
+39
-0
packages/uni-cli-shared/src/json/app/manifest/index.ts
packages/uni-cli-shared/src/json/app/manifest/index.ts
+2
-0
packages/uni-cli-shared/src/json/app/manifest/merge.ts
packages/uni-cli-shared/src/json/app/manifest/merge.ts
+0
-23
packages/uni-cli-shared/src/messages/index.ts
packages/uni-cli-shared/src/messages/index.ts
+1
-1
packages/uni-h5-vite/src/plugins/mainJs.ts
packages/uni-h5-vite/src/plugins/mainJs.ts
+3
-3
未找到文件。
packages/uni-app-vite/src/plugins/mainJs.ts
浏览文件 @
36b699b3
...
...
@@ -21,10 +21,10 @@ export function uniMainJsPlugin() {
}
function
createApp
(
code
:
string
)
{
return
`
const __app__=createApp().app;__app__._component.mpType='app';__app__._component.render=()=>{};__app__.use(uni.__vuePlugin).mount("#app");
${
code
.
replace
(
return
`
${
code
.
replace
(
'
createSSRApp
'
,
'
createVueApp as createSSRApp
'
)}
`
)}
;const __app__=createApp().app;__app__._component.mpType='app';__app__._component.render=()=>{};__app__.use(uni.__vuePlugin).mount("#app");
`
}
function
createLegacyApp
(
code
:
string
)
{
...
...
packages/uni-cli-shared/src/json/app/manifest/i18n.ts
0 → 100644
浏览文件 @
36b699b3
import
{
compileI18nJsonStr
}
from
'
@dcloudio/uni-i18n
'
import
{
M
}
from
'
../../../messages
'
import
{
initI18nOptions
}
from
'
../../../i18n
'
export
function
initI18n
(
manifestJson
:
Record
<
string
,
any
>
,
userManifestJson
:
Record
<
string
,
any
>
)
{
const
i18nOptions
=
initI18nOptions
(
process
.
env
.
UNI_INPUT_DIR
,
userManifestJson
.
fallbackLocale
)
let
fallbackLocale
:
string
|
undefined
=
undefined
if
(
i18nOptions
)
{
fallbackLocale
=
i18nOptions
.
locale
if
(
!
userManifestJson
.
fallbackLocale
)
{
console
.
warn
(
M
[
'
i18n.fallbackLocale.missing
'
].
replace
(
'
{locale}
'
,
fallbackLocale
)
)
}
else
if
(
userManifestJson
.
fallbackLocale
!==
fallbackLocale
)
{
console
.
warn
(
M
[
'
i18n.fallbackLocale.unmatch
'
].
replace
(
'
{locale}
'
,
userManifestJson
.
fallbackLocale
)
)
}
if
(
manifestJson
.
plus
.
tabBar
)
{
manifestJson
.
plus
.
tabBar
=
JSON
.
parse
(
compileI18nJsonStr
(
JSON
.
stringify
(
manifestJson
.
plus
.
tabBar
),
i18nOptions
)
)
}
manifestJson
.
fallbackLocale
=
fallbackLocale
}
}
packages/uni-cli-shared/src/json/app/manifest/index.ts
浏览文件 @
36b699b3
...
...
@@ -10,6 +10,7 @@ import { initConfusion } from './confusion'
import
{
initUniApp
}
from
'
./uniApp
'
import
{
initLaunchwebview
}
from
'
./launchwebview
'
import
{
initTabBar
}
from
'
./tabBar
'
import
{
initI18n
}
from
'
./i18n
'
export
function
normalizeAppManifestJson
(
userManifestJson
:
Record
<
string
,
any
>
,
...
...
@@ -32,6 +33,7 @@ export function normalizeAppManifestJson(
manifestJson
,
pagesJson
)
initI18n
(
manifestJson
,
userManifestJson
)
return
manifestJson
}
...
...
packages/uni-cli-shared/src/json/app/manifest/merge.ts
浏览文件 @
36b699b3
import
{
recursive
}
from
'
merge
'
import
{
M
}
from
'
../../../messages
'
import
{
initI18nOptions
}
from
'
../../../i18n
'
export
function
initRecursiveMerge
(
manifestJson
:
Record
<
string
,
any
>
,
userManifestJson
:
Record
<
string
,
any
>
):
Record
<
string
,
any
>
{
const
i18nOptions
=
initI18nOptions
(
process
.
env
.
UNI_INPUT_DIR
,
userManifestJson
.
fallbackLocale
)
let
fallbackLocale
:
string
|
undefined
=
undefined
if
(
i18nOptions
)
{
fallbackLocale
=
i18nOptions
.
locale
if
(
!
userManifestJson
.
fallbackLocale
)
{
console
.
warn
(
M
[
'
i18n.fallbackLocale.missing
'
].
replace
(
'
{locale}
'
,
fallbackLocale
)
)
}
else
if
(
userManifestJson
.
fallbackLocale
!==
fallbackLocale
)
{
console
.
warn
(
M
[
'
i18n.fallbackLocale.unmatch
'
].
replace
(
'
{locale}
'
,
userManifestJson
.
fallbackLocale
)
)
}
}
return
recursive
(
true
,
manifestJson
,
...
...
@@ -38,7 +16,6 @@ export function initRecursiveMerge(
code
:
userManifestJson
.
versionCode
,
},
locale
:
userManifestJson
.
locale
,
fallbackLocale
,
},
{
plus
:
userManifestJson
[
'
app-plus
'
]
}
)
...
...
packages/uni-cli-shared/src/messages/index.ts
浏览文件 @
36b699b3
...
...
@@ -15,5 +15,5 @@ export const M = {
'
i18n.fallbackLocale.missing
'
:
'
当前应用未在manifest.json配置fallbackLocale,默认使用:{locale}
'
,
'
i18n.fallbackLocale.unmatch
'
:
'
当前应用配置的fallbackLocale为:
$
{locale},但locale目录缺少该语言文件
'
,
'
当前应用配置的fallbackLocale为:{locale},但locale目录缺少该语言文件
'
,
}
packages/uni-h5-vite/src/plugins/mainJs.ts
浏览文件 @
36b699b3
...
...
@@ -37,10 +37,10 @@ export function uniMainJsPlugin() {
}
function
createApp
(
code
:
string
)
{
return
`import { plugin as __plugin } from '@dcloudio/uni-h5';
createApp().app.use(__plugin).mount("#app");
${
code
.
replace
(
return
`import { plugin as __plugin } from '@dcloudio/uni-h5';
${
code
.
replace
(
'
createSSRApp
'
,
'
createVueApp as createSSRApp
'
)}
`
)}
;createApp().app.use(__plugin).mount("#app");
`
}
function
createLegacyApp
(
code
:
string
)
{
...
...
@@ -51,7 +51,7 @@ function createLegacyApp(code: string) {
}
function
createSSRClientApp
(
code
:
string
)
{
return
`import { plugin as __plugin } from '@dcloudio/uni-h5';import { UNI_SSR, UNI_SSR_STORE } from '@dcloudio/uni-shared';
const { app: __app, store: __store } = createApp();__app.use(__plugin);__store && window[UNI_SSR] && window[UNI_SSR][UNI_SSR_STORE] && __store.replaceState(window[UNI_SSR][UNI_SSR_STORE]);__app.router.isReady().then(() => __app.mount("#app"));
${
code
}
`
return
`import { plugin as __plugin } from '@dcloudio/uni-h5';import { UNI_SSR, UNI_SSR_STORE } from '@dcloudio/uni-shared';
${
code
}
;const { app: __app, store: __store } = createApp();__app.use(__plugin);__store && window[UNI_SSR] && window[UNI_SSR][UNI_SSR_STORE] && __store.replaceState(window[UNI_SSR][UNI_SSR_STORE]);__app.router.isReady().then(() => __app.mount("#app"));
`
}
function
createSSRServerApp
(
code
:
string
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录