WDRouterPage.ets
744 Bytes
import bundleManager from '@ohos.bundle.bundleManager'
export class WDRouterPage {
private moduleName: string
private pagePath: string
constructor(moduleName: string, pagePath: string) {
this.moduleName = moduleName
this.pagePath = pagePath
}
url() {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
return `@bundle:${bundleInfo.name}/${this.moduleName}/${this.pagePath}`
}
// 主页
static index = new WDRouterPage("entry", "ets/pages/Index");
// 关于页面
// static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage");
// web默认页面
static defaultWebPage = new WDRouterPage("entry", "ets/pages/web/DefaultWebPage");
}