31 行
840 B
Plaintext
31 行
840 B
Plaintext
import { router } from '@kit.ArkUI';
|
|
import { BusinessError } from '@kit.BasicServicesKit';
|
|
import { ToolsHelper } from './ToolsHelper';
|
|
|
|
const XWebview = import('../pages/XWebview');
|
|
|
|
|
|
export interface XWebParams {
|
|
url: string
|
|
title?: string
|
|
}
|
|
|
|
export class XWebHelper {
|
|
/**
|
|
* 打开web页面,加载h5
|
|
* @param params
|
|
*/
|
|
public static openWeb(params: XWebParams) {
|
|
|
|
router.pushNamedRoute({
|
|
name: 'XWebview',
|
|
params: params
|
|
}, router.RouterMode.Single).then(() => {
|
|
console.info('Succeeded in jumping to the XWebview page.')
|
|
|
|
}).catch((err: BusinessError) => {
|
|
console.error(`Failed to jump to the second page.Code is ${err.code}, message is ${err.message}`)
|
|
ToolsHelper.showMessage(`Failed to jump to the second page.Code is ${err.code}, message is ${err.message}`)
|
|
})
|
|
}
|
|
} |