HarmonyOS鸿蒙Next中当前自定义隐私政策弹窗无法正常弹出
HarmonyOS鸿蒙Next中当前自定义隐私政策弹窗无法正常弹出 【问题描述】:当前自定义隐私政策弹窗无法正常弹出,使用的是V2装饰器
【问题现象】:
import { router } from '@kit.ArkUI'
@Entry
@ComponentV2
struct textPage {
private timerId: number = -1;
@Provider() stackPath: NavPathStack = new NavPathStack()
aboutToAppear(): void {
// LoadingDialogClass.setContext(this.getUIContext())
this.goNextPage()
}
aboutToDisappear(): void {
// 页面销毁时清除定时器
if (this.timerId !== -1) {
clearTimeout(this.timerId);
}
}
// 跳转下一页
async goNextPage() {
this.stackPath.pushPath({ name: 'HidePolicyDialog' })
return
this.timerId = setTimeout(() => {
router.replaceUrl({ url: 'pages/Index' })
}, 2000)
}
build() {
Column() {
Image($r('app.media.startWindowImg'))
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
【版本信息】:IDE6.1.1
更多关于HarmonyOS鸿蒙Next中当前自定义隐私政策弹窗无法正常弹出的实战教程也可以访问 https://www.itying.com/category-93-b0.html
当前textPage页面中只是调用了pushPath这个方法进行跳转,但是缺少navigition容器
更多关于HarmonyOS鸿蒙Next中当前自定义隐私政策弹窗无法正常弹出的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
在HarmonyOS NEXT中,自定义隐私政策弹窗无法弹出通常是由于未正确配置 module.json5 中的 removePermissions 标签或未在 PrivacyStatement 中声明自定义弹窗。请检查 entry/src/main/resources/base/profile/privacy_config.json 文件是否存在、路径是否正确,并确保 "customize" 字段为 true 且 "complianceType" 设置为 "custom"。同时确认弹窗代码在 onWindowStageCreate 之后调用。,
build() {
Navigation(this.stackPath) {
Column() {
Image($r('app.media.startWindowImg'))
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
另外,goNextPage中的return导致后续setTimeout不执行,若需2秒后跳转应移除return。

