fes.js/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl
2022-01-04 16:19:17 +08:00

33 lines
750 B
Smarty

import {
defineComponent, isRef, watch
} from 'vue';
import { MicroApp } from './MicroApp';
export const MicroAppWithMemoHistory = defineComponent({
components: {
MicroApp
},
props: {
name: {
type: String,
required: true
},
settings: Object,
lifeCycles: Object,
url: String
},
setup(props, { attrs }) {
let microRouter;
const onRouterInit = (router) => {
microRouter = router;
microRouter.push(props.url);
};
watch(()=>props.url, () => {
microRouter.push(props.url);
});
return () => <MicroApp onRouterInit={onRouterInit} {...props} {...attrs}></MicroApp>;
}
});