【关键字】
AES加解密 / 分段加解密 / 较大的数据加解密
【问题描述】
在A界面使用router.pushNamedRoute跳转B界面后,在B界面使用router.back指定URL及params无法返回A界面。
在log中可以看到以下日志:
02-19 16:27:15.156 27853-27853 C03900/Ace com.example.myapplication I [page_router_manager.cpp(BackWithTarget)-(0)] router.Back path = <private>
02-19 16:27:15.156 27853-27853 C03900/Ace com.example.myapplication I [overlay_manager.cpp(RemoveOverlay)-(0)] No overlay in this page.
02-19 16:27:15.157 27853-27853 C03900/Ace com.example.myapplication W [page_router_manager.cpp(StartBack)-(0)] fail to find specified page to pop
具体示例代码如下:
import router from '@ohos.router'
import { BusinessError } from '@ohos.base'
import hilog from '@ohos.hilog'
const module = import('entry/src/main/ets/pages/secondPage'); // 引入共享包中的命名路由页面
@Entry({ routeName: 'tztZFFirstPage' })
@Component
export struct firstPage {
build(){
Row() {
Column() {
Text('firstPage')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
.onClick(()=>{
router.pushNamedRoute({
name: "tztZFSecondPage",
}).catch((err: BusinessError) => {
})
// router.pushUrl({
// url: "pages/secondPage",
// }, router.RouterMode.Single).catch((err: BusinessError) => {
// hilog.debug(0x000, "wlz123", JSON.stringify(err))
// })
})
}
}
import router from '@ohos.router'
import { BusinessError } from '@ohos.base'
const module = import('entry/src/main/ets/pages/firstPage'); // 引入共享包中的命名路由页面
@Entry({ routeName: 'tztZFSecondPage' })
@Component
export struct secondPage {
build(){
Row() {
Column() {
Text('secondPage')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
.onClick(()=>{
router.back({url: 'tztZFFirstPage'})
// router.back({url: 'pages/firstPage'})
})
}
}
【解决方案】
back不支持使用URL返回页面。直接使用router.back,不加参数,支持page/xxPage这种。