mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-09-05 23:16:49 +08:00
Merge branch 'vue3' of https://github.com/WeBankFinTech/fes.js into vue3
This commit is contained in:
commit
e15a350f6c
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.0-rc.25",
|
"version": "2.0.0-rc.26",
|
||||||
"changelog": {
|
"changelog": {
|
||||||
"repo": "WeBankFinTech/fes.js",
|
"repo": "WeBankFinTech/fes.js",
|
||||||
"cacheDir": ".changelog",
|
"cacheDir": ".changelog",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/create-fes-app",
|
"name": "@fesjs/create-fes-app",
|
||||||
"version": "2.0.0-rc.23",
|
"version": "2.0.0-rc.26",
|
||||||
"description": "create a app base on fes.js",
|
"description": "create a app base on fes.js",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -10,3 +10,22 @@ export const beforeRender = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const qiankun = {
|
||||||
|
// 应用加载之前
|
||||||
|
async bootstrap(props) {
|
||||||
|
console.log('app1 bootstrap', props);
|
||||||
|
},
|
||||||
|
// 应用 render 之前触发
|
||||||
|
async mount(props) {
|
||||||
|
console.log('app1 mount', props);
|
||||||
|
},
|
||||||
|
// 当 props 更新时触发
|
||||||
|
async update(props) {
|
||||||
|
console.log('app1 update', props);
|
||||||
|
},
|
||||||
|
// 应用卸载之后触发
|
||||||
|
async unmount(props) {
|
||||||
|
console.log('app1 unmount', props);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<config>
|
<config>
|
||||||
{
|
{
|
||||||
"name": "index",
|
"name": "test",
|
||||||
"title": "home"
|
"title": "test"
|
||||||
}
|
}
|
||||||
</config>
|
</config>
|
||||||
<script>
|
<script>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
main
|
main
|
||||||
<a-tabs v-model:activeKey="activeKey">
|
<a-tabs v-model:activeKey="activeKey">
|
||||||
<a-tab-pane key="1" tab="Tab 1"> <MicroAppWithMemoHistory key="1" name="app1" url="/app1" /></a-tab-pane>
|
<a-tab-pane key="1" tab="Tab 1"><MicroAppWithMemoHistory key="1" name="app1" url="/app1" /></a-tab-pane>
|
||||||
<a-tab-pane key="2" tab="Tab 2"><MicroAppWithMemoHistory key="2" name="app1" url="/app1/test" /></a-tab-pane>
|
<a-tab-pane key="2" tab="Tab 2"><MicroAppWithMemoHistory key="2" name="app1" url="/app1/test" /></a-tab-pane>
|
||||||
<a-tab-pane key="3" tab="Tab 3">Content of Tab Pane 3</a-tab-pane>
|
<a-tab-pane key="3" tab="Tab 3">Content of Tab Pane 3</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/plugin-qiankun",
|
"name": "@fesjs/plugin-qiankun",
|
||||||
"version": "2.0.0-rc.24",
|
"version": "2.0.0-rc.26",
|
||||||
"description": "@fesjs/plugin-qiankun",
|
"description": "@fesjs/plugin-qiankun",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -38,9 +38,11 @@ function getSlaveRuntime() {
|
|||||||
// 子应用生命周期钩子Bootstrap
|
// 子应用生命周期钩子Bootstrap
|
||||||
export function genBootstrap(oldRender, appPromise) {
|
export function genBootstrap(oldRender, appPromise) {
|
||||||
return async (props) => {
|
return async (props) => {
|
||||||
const slaveRuntime = getSlaveRuntime();
|
if (typeof props !== 'undefined') {
|
||||||
if (slaveRuntime.bootstrap) {
|
const slaveRuntime = getSlaveRuntime();
|
||||||
await slaveRuntime.bootstrap(props);
|
if (slaveRuntime.bootstrap) {
|
||||||
|
await slaveRuntime.bootstrap(props);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
render = oldRender;
|
render = oldRender;
|
||||||
if (isPromise(appPromise)) {
|
if (isPromise(appPromise)) {
|
||||||
@ -61,23 +63,22 @@ export function genMount(mountElementId) {
|
|||||||
if (slaveRuntime.mount) {
|
if (slaveRuntime.mount) {
|
||||||
await slaveRuntime.mount(props);
|
await slaveRuntime.mount(props);
|
||||||
}
|
}
|
||||||
}
|
// 更新 clientRender 配置
|
||||||
|
const clientRenderOpts = {
|
||||||
|
// 支持通过 props 注入 container 来限定子应用 mountElementId 的查找范围
|
||||||
|
// 避免多个子应用出现在同一主应用时出现 mount 冲突
|
||||||
|
rootElement:
|
||||||
|
props?.container?.querySelector(mountElementId) || mountElementId
|
||||||
|
};
|
||||||
|
|
||||||
// 更新 clientRender 配置
|
clientRenderOptsStack.push(clientRenderOpts);
|
||||||
const clientRenderOpts = {
|
|
||||||
// 支持通过 props 注入 container 来限定子应用 mountElementId 的查找范围
|
|
||||||
// 避免多个子应用出现在同一主应用时出现 mount 冲突
|
|
||||||
rootElement:
|
|
||||||
props?.container?.querySelector(mountElementId) || mountElementId
|
|
||||||
};
|
|
||||||
|
|
||||||
clientRenderOptsStack.push(clientRenderOpts);
|
if(props.url){
|
||||||
|
history.url = props.url || '/';
|
||||||
if(props.url){
|
}
|
||||||
history.url = props.url || '/';
|
if(props.onRouterInit){
|
||||||
}
|
history.onRouterInit = props.onRouterInit;
|
||||||
if(props.onRouterInit){
|
}
|
||||||
history.onRouterInit = props.onRouterInit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第一次 mount 会自动触发 render,非第一次 mount 则需手动触发
|
// 第一次 mount 会自动触发 render,非第一次 mount 则需手动触发
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/plugin-request",
|
"name": "@fesjs/plugin-request",
|
||||||
"version": "2.0.0-rc.21",
|
"version": "2.0.0-rc.26",
|
||||||
"description": "@fesjs/plugin-request",
|
"description": "@fesjs/plugin-request",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
@ -34,4 +34,4 @@
|
|||||||
"axios": "0.21.1",
|
"axios": "0.21.1",
|
||||||
"@fesjs/compiler": "^2.0.0-rc.5"
|
"@fesjs/compiler": "^2.0.0-rc.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/preset-built-in",
|
"name": "@fesjs/preset-built-in",
|
||||||
"version": "2.0.0-rc.24",
|
"version": "2.0.0-rc.26",
|
||||||
"description": "@fesjs/preset-built-in",
|
"description": "@fesjs/preset-built-in",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
@ -72,4 +72,4 @@
|
|||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^3.11.2",
|
||||||
"webpackbar": "^5.0.0-3"
|
"webpackbar": "^5.0.0-3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ const renderClient = (opts = {}) => {
|
|||||||
plugin.applyPlugins({
|
plugin.applyPlugins({
|
||||||
key: 'onAppCreated',
|
key: 'onAppCreated',
|
||||||
type: ApplyPluginsType.event,
|
type: ApplyPluginsType.event,
|
||||||
args: { app },
|
args: { app, routes },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (rootElement) {
|
if (rootElement) {
|
||||||
|
@ -16,7 +16,7 @@ export function getRoutes() {
|
|||||||
const ROUTER_BASE = '{{{ routerBase }}}';
|
const ROUTER_BASE = '{{{ routerBase }}}';
|
||||||
let router = null;
|
let router = null;
|
||||||
let history = null;
|
let history = null;
|
||||||
export const createRouter = () => {
|
export const createRouter = (routes) => {
|
||||||
if (router) {
|
if (router) {
|
||||||
return router;
|
return router;
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ export const createRouter = () => {
|
|||||||
});
|
});
|
||||||
router = createVueRouter({
|
router = createVueRouter({
|
||||||
history,
|
history,
|
||||||
routes: getRoutes()
|
routes
|
||||||
});
|
});
|
||||||
|
|
||||||
plugin.applyPlugins({
|
plugin.applyPlugins({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createRouter } from "./routes";
|
import { createRouter } from "./routes";
|
||||||
|
|
||||||
export function onAppCreated({ app }) {
|
export function onAppCreated({ app, routes }) {
|
||||||
const router = createRouter();
|
const router = createRouter(routes);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
}
|
}
|
||||||
|
@ -12,3 +12,7 @@ export const request = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function patchRoutes() {
|
||||||
|
console.log('patchRoutes');
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/fes",
|
"name": "@fesjs/fes",
|
||||||
"version": "2.0.0-rc.24",
|
"version": "2.0.0-rc.26",
|
||||||
"description": "一个好用的前端管理台快速开发框架",
|
"description": "一个好用的前端管理台快速开发框架",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -40,7 +40,7 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fesjs/compiler": "^2.0.0-rc.5",
|
"@fesjs/compiler": "^2.0.0-rc.5",
|
||||||
"@fesjs/preset-built-in": "^2.0.0-rc.24",
|
"@fesjs/preset-built-in": "^2.0.0-rc.26",
|
||||||
"@fesjs/runtime": "^2.0.0-rc.5",
|
"@fesjs/runtime": "^2.0.0-rc.5",
|
||||||
"@umijs/utils": "3.3.3",
|
"@umijs/utils": "3.3.3",
|
||||||
"resolve-cwd": "^3.0.0"
|
"resolve-cwd": "^3.0.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user