WDRouterRule.ets
848 Bytes
import router from '@ohos.router'
import { Action } from 'wdBean'
import { ToastUtils } from 'wdKit'
import { Action2Page } from './Action2Page'
import { WDRouterPage } from './WDRouterPage'
export class WDRouterRule {
static jumpWithAction(action?: Action) {
if (!action || !action.type) {
ToastUtils.showToast("跳转参数异常", 1000);
return
}
let page = Action2Page.get(action);
WDRouterRule.jumpWithPage(page, action)
}
private static jumpWithPage(page?: WDRouterPage, params?: object) {
if (page) {
if (params) {
// router.pushUrl({ url: 'pages/routerpage2', , params: params })
router.pushUrl({ url: page.url(), params: params })
} else {
router.pushUrl({ url: page.url() })
}
} else {
ToastUtils.showToast("功能开发中", 1000);
}
}
}