Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
8b2cdb0c
U
uni-app
项目概览
DCloud
/
uni-app
14 天 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8b2cdb0c
编写于
5月 25, 2024
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(harmony): 支持i18n
上级
51bd87e7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
15 deletion
+28
-15
packages/uni-app-harmony/build.json
packages/uni-app-harmony/build.json
+5
-5
packages/uni-app-harmony/src/service/api/route/navigateBack.ts
...ges/uni-app-harmony/src/service/api/route/navigateBack.ts
+8
-4
packages/uni-app-harmony/src/service/framework/app/index.ts
packages/uni-app-harmony/src/service/framework/app/index.ts
+13
-5
packages/uni-app-harmony/src/service/index.ts
packages/uni-app-harmony/src/service/index.ts
+2
-1
未找到文件。
packages/uni-app-harmony/build.json
浏览文件 @
8b2cdb0c
...
...
@@ -16,11 +16,11 @@
"__VUE_PROD_HYDRATION_MISMATCH_DETAILS__"
:
"false"
,
"__UNI_FEATURE_WX__"
:
"true"
,
"__UNI_FEATURE_PROMISE__"
:
"false"
,
"__UNI_FEATURE_I18N_EN__"
:
"
fals
e"
,
"__UNI_FEATURE_I18N_ES__"
:
"
fals
e"
,
"__UNI_FEATURE_I18N_FR__"
:
"
fals
e"
,
"__UNI_FEATURE_I18N_ZH_HANS__"
:
"
fals
e"
,
"__UNI_FEATURE_I18N_ZH_HANT__"
:
"
fals
e"
,
"__UNI_FEATURE_I18N_EN__"
:
"
tru
e"
,
"__UNI_FEATURE_I18N_ES__"
:
"
tru
e"
,
"__UNI_FEATURE_I18N_FR__"
:
"
tru
e"
,
"__UNI_FEATURE_I18N_ZH_HANS__"
:
"
tru
e"
,
"__UNI_FEATURE_I18N_ZH_HANT__"
:
"
tru
e"
,
"plus.os.name"
:
"'Harmony'"
,
"plus.os.version"
:
"''"
},
...
...
packages/uni-app-harmony/src/service/api/route/navigateBack.ts
浏览文件 @
8b2cdb0c
...
...
@@ -6,7 +6,12 @@ import {
NavigateBackProtocol
,
defineAsyncApi
,
}
from
'
@dcloudio/uni-api
'
import
{
getCurrentPage
,
invokeHook
}
from
'
@dcloudio/uni-core
'
import
{
getCurrentPage
,
initI18nAppMsgsOnce
,
invokeHook
,
useI18n
,
}
from
'
@dcloudio/uni-core
'
import
{
ON_BACK_PRESS
,
ON_SHOW
}
from
'
@dcloudio/uni-shared
'
import
{
...
...
@@ -60,11 +65,10 @@ export const navigateBack = defineAsyncApi<API_TYPE_NAVIGATE_BACK>(
let
firstBackTime
=
0
function
quit
()
{
// TODO
initI18nAppMsgsOnce()
initI18nAppMsgsOnce
()
if
(
!
firstBackTime
)
{
firstBackTime
=
Date
.
now
()
// TODO useI18n
plus
.
nativeUI
.
toast
(
'
再按一次退出應用
'
)
plus
.
nativeUI
.
toast
(
useI18n
().
t
(
'
uni.app.quit
'
))
setTimeout
(()
=>
{
firstBackTime
=
0
},
2000
)
...
...
packages/uni-app-harmony/src/service/framework/app/index.ts
浏览文件 @
8b2cdb0c
import
type
{
ComponentPublicInstance
}
from
'
vue
'
import
{
extend
}
from
'
@vue/shared
'
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
defineGlobalData
,
initService
}
from
'
@dcloudio/uni-core
'
import
{
defineGlobalData
,
init
AppVm
,
init
Service
}
from
'
@dcloudio/uni-core
'
import
{
initVueApp
}
from
'
@dcloudio/uni-app-plus/service/framework/app/vueApp
'
import
{
initSubscribeHandlers
}
from
'
./subscriber
'
import
{
initGlobalEvent
}
from
'
./initGlobalEvent
'
...
...
@@ -12,10 +12,18 @@ const defaultApp = {
globalData
:
{},
}
function
initAppVm
(
appVm
:
ComponentPublicInstance
)
{
appVm
.
$vm
=
appVm
appVm
.
$mpType
=
'
app
'
// TODO useI18n
export
function
getApp
({
allowDefault
=
false
}
=
{})
{
if
(
appCtx
)
{
// 真实的 App 已初始化
return
appCtx
}
if
(
allowDefault
)
{
// 返回默认实现
return
defaultApp
}
console
.
error
(
'
[warn]: getApp() failed. Learn more: https://uniapp.dcloud.io/collocation/frame/window?id=getapp.
'
)
}
export
function
registerApp
(
appVm
:
ComponentPublicInstance
)
{
...
...
packages/uni-app-harmony/src/service/index.ts
浏览文件 @
8b2cdb0c
import
*
as
uni
from
'
./api/index
'
import
{
UniServiceJSBridge
}
from
'
./bridge
'
import
{
registerApp
as
__registerApp
}
from
'
./framework/app
'
import
{
registerApp
as
__registerApp
,
getApp
}
from
'
./framework/app
'
import
{
definePage
as
__definePage
}
from
'
@dcloudio/uni-app-plus/service/framework/page
'
import
{
getCurrentPages
}
from
'
@dcloudio/uni-app-plus/service/framework/page
'
export
default
{
uni
,
getApp
,
getCurrentPages
,
__definePage
,
__registerApp
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录