mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-10-14 19:22:13 +08:00
feat: 乾坤增加entry配置,用于区别同一name不同位置用法
This commit is contained in:
parent
a6b596929b
commit
5a71f2999d
@ -10,7 +10,7 @@ export default {
|
||||
layout: {
|
||||
title: "Fes.js",
|
||||
footer: 'Created by MumbleFE',
|
||||
multiTabs: true,
|
||||
multiTabs: false,
|
||||
navigation: 'mixin',
|
||||
menus: [{
|
||||
name: 'index',
|
||||
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
main
|
||||
<input />
|
||||
<FTabs v-model="activeKey">
|
||||
<FTabPane name="Tab 1" value="1">
|
||||
<MicroAppWithMemoHistory key="1" name="app1" url="/app1" a="1" />
|
||||
|
@ -2,11 +2,11 @@ import { defaultHistoryType } from '../constants';
|
||||
|
||||
function getMicroApp(options) {
|
||||
const {
|
||||
key, microAppName, masterHistoryType, base, namespace, ...normalizedRouteProps
|
||||
key, microAppName, entry, masterHistoryType, base, namespace, ...normalizedRouteProps
|
||||
} = options;
|
||||
return `(() => {
|
||||
const { getMicroAppRouteComponent } = require('@@/${namespace}/getMicroAppRouteComponent');
|
||||
return getMicroAppRouteComponent({key: '${key}', appName: '${microAppName}', base: '${base}', masterHistoryType: '${masterHistoryType}', routeProps: ${JSON.stringify(normalizedRouteProps)} })
|
||||
return getMicroAppRouteComponent({key: '${key}', appName: '${microAppName}', entry: '${entry}', base: '${base}', masterHistoryType: '${masterHistoryType}', routeProps: ${JSON.stringify(normalizedRouteProps)} })
|
||||
})()`;
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ function modifyRoutesWithAttachMode({
|
||||
if (route.meta && route.meta.microApp) {
|
||||
route.component = getMicroApp({
|
||||
key: route.path,
|
||||
entry: route.meta.entry ?? route.path,
|
||||
microAppName: route.meta.microApp,
|
||||
masterHistoryType,
|
||||
base,
|
||||
|
@ -28,6 +28,7 @@ export const MicroApp = defineComponent({
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
entry: String,
|
||||
settings: Object,
|
||||
props: Object,
|
||||
lifeCycles: Object
|
||||
@ -80,7 +81,7 @@ export const MicroApp = defineComponent({
|
||||
const app = loadMicroApp(
|
||||
{
|
||||
// 保证唯一
|
||||
name: `${name}`,
|
||||
name: `${name}_${props.entry || ''}`,
|
||||
entry: entry,
|
||||
container: containerRef.value,
|
||||
props: {...propsConfigRef.value}
|
||||
|
@ -14,6 +14,7 @@ export const MicroAppWithMemoHistory = defineComponent({
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
entry: String,
|
||||
settings: Object,
|
||||
props: Object,
|
||||
lifeCycles: Object,
|
||||
|
@ -3,10 +3,11 @@ import { MicroApp } from './MicroApp';
|
||||
export function getMicroAppRouteComponent({
|
||||
key,
|
||||
appName,
|
||||
entry,
|
||||
base,
|
||||
masterHistoryType,
|
||||
routeProps
|
||||
}) {
|
||||
|
||||
return <MicroApp key={key} base={base} masterHistoryType={masterHistoryType} name={appName} {...routeProps} />;
|
||||
return <MicroApp key={key} base={base} masterHistoryType={masterHistoryType} name={appName} entry={entry} {...routeProps} />;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user