import {
JumpRouter,
JumpRouterOptions,
JumpRouterSuccess,
JumpRouterFail,
JumpRouterComplete
} from '../interface.uts'
export {
JumpRouter,
JumpRouterOptions,
JumpRouterSuccess,
JumpRouterFail,
JumpRouterComplete
}
import { hilog } from '@kit.PerformanceAnalysisKit';
import { router } from '@kit.ArkUI';
interface RouterOptions {
url: string,
}
export function jumpMap(options : JumpRouterOptions) {
try {
const params: RouterOptions = {
url: 'pages/Main'
}
console.log("params: " + JSON.stringify(params));
router.pushUrl(params)
let result : JumpRouterSuccess = {
errMsg: "ok"
};
const completeResult : JumpRouterComplete = {
errMsg: "ok"
}
options?.success?.(result);
options?.complete?.(completeResult);
return
} catch (err) {
hilog.error(0, 'TAG', `loadProduct failed. code is ${err.code}, message is ${err.message}`);
let result : JumpRouterFail = {
errMsg: err.message ?? ""
};
const completeResult : JumpRouterComplete = {
errMsg: err.message ?? ""
}
options?.fail?.(result);
options?.complete?.(completeResult);
}
}
uni_modules 写的uts 插件 可以跳转到鸿蒙 原生页面 , 怎么在原生页面 通讯 发送消息到uniapp
yangjw (作者)
可以这么理解, 使用uts 跳转到 鸿蒙原生指定的页面, 想回参 给 uniapp
2025-07-08 21:36
DCloud_UNI_yuhe
回复 yangjw: 暂时还没有遇到,或者你可以提供一下一个可以复现的项目?
2025-07-09 11:11
yangjw (作者)
回复 DCloud_UNI_yuhe: 调用鸿蒙模块
import {
JumpRouter,
JumpRouterOptions,
JumpRouterSuccess,
JumpRouterFail,
JumpRouterComplete
} from '../interface.uts'
export {
JumpRouter,
JumpRouterOptions,
JumpRouterSuccess,
JumpRouterFail,
JumpRouterComplete
}
import { hilog } from '@kit.PerformanceAnalysisKit';
import { router } from '@kit.ArkUI';
interface RouterOptions {
url: string,
}
export interface NativeEmbedEvent{
detail:object
}
export function jumpMap(options : JumpRouterOptions) {
try {
const params: RouterOptions = {
url: 'pages/Main'
}
console.log("params: " + JSON.stringify(params));
router.pushUrl(params)
}
本地打包,调用
import { router } from '@kit.ArkUI';
import { } from "@dcloudio/uni-app-runtime";
@Entry
@Component
struct Main {
@State message: string = 'Hello World';
build() {
RelativeContainer() {
Text(this.message)
.id('MainHelloWorld')
.fontSize($r('app.float.page_text_font_size'))
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: 'container', align: VerticalAlign.Center },
middle: { anchor: 'container', align: HorizontalAlign.Center }
})
.onClick(() => {
// this.message = 'Welcome';
router.back()
})
}
.height('100%')
.width('100%')
}
}
在鸿蒙页面
.onClick(() => {
// this.message = 'Welcome';
router.back()
})
怎么回调传参
2025-07-09 14:25
DCloud_UNI_yuhe
回复 yangjw: 暂时应该没有办法直接调用,你可以试一下uniappx的原生混编
2025-07-23 16:36