Skip to content

Commit

Permalink
Merge pull request #595 from handsomeliuyang/58/harmony-hybrid-3.6.29…
Browse files Browse the repository at this point in the history
…-liuyang

解决容器共用时,Taro的navigate和原生loadUrl混用问题
  • Loading branch information
handsomeliuyang authored Jun 17, 2024
2 parents 1d07220 + 5fe95e3 commit 6241ea0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ export class NativeApi {
callInstanceAsync (option: any): any {
return option
}

@(asyncAndNotRelease)
onNativeNavigate(_options: any): void{}
}

export interface Status {
Expand Down
16 changes: 16 additions & 0 deletions packages/taro-platform-harmony-hybrid/src/api/apis/taro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
reLaunch,
switchTab,
} from './index'
import native from "./NativeApi";

const requirePlugin = () => {
return {
Expand Down Expand Up @@ -92,3 +93,18 @@ export {
pxTransform,
requirePlugin
}

// 监听原生的Navigate方法
native.onNativeNavigate({
nativeNavigateTo: (url: string)=>{
navigateTo({
url: url,
success: function ( ) {}
})
},
nativeNavigateBack: (delta: number) => {
navigateBack({
delta: delta
})
}
})

0 comments on commit 6241ea0

Please sign in to comment.