Skip to content

Commit

Permalink
Update jump.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bailicangdu authored Aug 4, 2022
1 parent 678e9c9 commit 35f191d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/zh-cn/jump.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import microApp from '@micro-zoe/micro-app'
microApp.setData('子应用name', { path: '/new-path/' })
```


## 方式三、传递路由实例方法

*适用场景: 子应用控制基座跳转*
Expand All @@ -66,12 +67,13 @@ microApp.setData('子应用name', { path: '/new-path/' })
```js
import { useEffect } from 'react'
import { useHistory } from 'react-router-dom'
import microApp from '@micro-zoe/micro-app'
import microApp, { removeDomScope } from '@micro-zoe/micro-app'

export default () => {
const history = useHistory()

function pushState (path) {
removeDomScope()
history.push(path)
}

Expand Down Expand Up @@ -100,11 +102,14 @@ export default () => {
</template>

<script>
import { removeDomScope } from '@micro-zoe/micro-app'
export default {
data () {
return {
microAppData: {
pushState: (path) => {
removeDomScope()
this.$router.push(path)
}
}
Expand Down

0 comments on commit 35f191d

Please sign in to comment.