mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
fix: mountElementId改为app,不带#
This commit is contained in:
parent
d31e4d7613
commit
444ac52e93
@ -1,4 +1,4 @@
|
|||||||
export const defaultMainRootId = '#root-master';
|
export const defaultMainRootId = 'root-master';
|
||||||
export const defaultHistoryType = 'hash';
|
export const defaultHistoryType = 'hash';
|
||||||
export const qiankunStateForMicroModelNamespace = 'qiankunStateForMicro';
|
export const qiankunStateForMicroModelNamespace = 'qiankunStateForMicro';
|
||||||
export const qiankunStateFromMainModelNamespace = 'qiankunStateFromMain';
|
export const qiankunStateFromMainModelNamespace = 'qiankunStateFromMain';
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
// import { deferred } from '@@/plugin-qiankun/qiankunDefer.js';
|
|
||||||
// import '@@/plugin-qiankun/qiankunRootExports.js';
|
|
||||||
// import subAppConfig from '@@/plugin-qiankun/subAppsConfig.json';
|
|
||||||
// import { registerMicroApps, start } from 'qiankun';
|
|
||||||
// import { createApp, h } from 'vue';
|
|
||||||
// import { plugin, ApplyPluginsType } from '@@/core/coreExports';
|
|
||||||
// import { defaultMountContainerId, testPathWithPrefix, toArray } from '../common';
|
|
||||||
|
|
||||||
// async function getMasterRuntime() {
|
|
||||||
// const config = plugin.applyPlugins({
|
|
||||||
// key: 'qiankun',
|
|
||||||
// type: ApplyPluginsType.modify,
|
|
||||||
// initialValue: {},
|
|
||||||
// async: true
|
|
||||||
// });
|
|
||||||
// const { master } = config;
|
|
||||||
// return master || config;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export async function render(oldRender) {
|
|
||||||
// oldRender();
|
|
||||||
// function isAppActive(location, history, base) {
|
|
||||||
// const baseConfig = toArray(base);
|
|
||||||
// switch (history.type || history) {
|
|
||||||
// case 'hash':
|
|
||||||
// return baseConfig.some(pathPrefix => testPathWithPrefix(`#${pathPrefix}`, location.hash));
|
|
||||||
// case 'browser':
|
|
||||||
// return baseConfig.some(pathPrefix => testPathWithPrefix(pathPrefix, location.pathname));
|
|
||||||
// default:
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// const runtimeConfig = await getMasterRuntime();
|
|
||||||
// const {
|
|
||||||
// apps, jsSandbox = false, prefetch = true, defer = false, lifeCycles, masterHistory, ...otherConfigs
|
|
||||||
// } = {
|
|
||||||
// ...subAppConfig,
|
|
||||||
// ...runtimeConfig
|
|
||||||
// };
|
|
||||||
|
|
||||||
// assert(apps && apps.length, 'sub apps must be config when using fes-plugin-qiankun');
|
|
||||||
|
|
||||||
// registerMicroApps(apps.map(({
|
|
||||||
// name, entry, base, history = masterHistory, mountElementId = defaultMountContainerId, props
|
|
||||||
// }) => ({
|
|
||||||
// name,
|
|
||||||
// entry,
|
|
||||||
// activeRule: location => isAppActive(location, history, base),
|
|
||||||
// render: ({ appContent, loading }) => {
|
|
||||||
// if (process.env.NODE_ENV === 'development') {
|
|
||||||
// console.info(`app ${name} loading ${loading}`);
|
|
||||||
// }
|
|
||||||
// if (mountElementId) {
|
|
||||||
// const container = document.getElementById(mountElementId);
|
|
||||||
// if (container) {
|
|
||||||
// const subApp = {
|
|
||||||
// setup() {
|
|
||||||
|
|
||||||
// },
|
|
||||||
// render() {
|
|
||||||
// h('div', {
|
|
||||||
// dangerouslySetInnerHTML: {
|
|
||||||
// __html: appContent
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// const app = createApp();
|
|
||||||
// app.mount(subApp, container);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// props: {
|
|
||||||
// base,
|
|
||||||
// history,
|
|
||||||
// ...props
|
|
||||||
// }
|
|
||||||
// })), lifeCycles);
|
|
||||||
|
|
||||||
// if (defer) {
|
|
||||||
// await deferred.promise;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// start({ jsSandbox, prefetch, ...otherConfigs });
|
|
||||||
// }
|
|
@ -164,8 +164,8 @@ export default function (api) {
|
|||||||
api.addEntryCode(
|
api.addEntryCode(
|
||||||
() => `
|
() => `
|
||||||
export const bootstrap = qiankun_genBootstrap(completeClientRender, app);
|
export const bootstrap = qiankun_genBootstrap(completeClientRender, app);
|
||||||
export const mount = qiankun_genMount('${api.config.mountElementId}');
|
export const mount = qiankun_genMount('#${api.config.mountElementId}');
|
||||||
export const unmount = qiankun_genUnmount('${api.config.mountElementId}');
|
export const unmount = qiankun_genUnmount('#${api.config.mountElementId}');
|
||||||
export const update = qiankun_genUpdate();
|
export const update = qiankun_genUpdate();
|
||||||
|
|
||||||
if (!window.__POWERED_BY_QIANKUN__) {
|
if (!window.__POWERED_BY_QIANKUN__) {
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
// import { h } from 'vue';
|
|
||||||
// import qiankunRender from './lifecycles';
|
|
||||||
|
|
||||||
// export function rootContainer(container) {
|
|
||||||
// const value = typeof window !== 'undefined' ? window.g_rootExports : {};
|
|
||||||
// const { Context } = require('@@/plugin-qiankun/qiankunContext');
|
|
||||||
// return h(Context.Provider, { value }, container);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export const render = oldRender => qiankunRender().then(() => {
|
|
||||||
// oldRender();
|
|
||||||
// });
|
|
@ -13,12 +13,12 @@ export default async function createHtmlWebpackConfig({
|
|||||||
isProd
|
isProd
|
||||||
}) {
|
}) {
|
||||||
const htmlOptions = {
|
const htmlOptions = {
|
||||||
|
title: 'fes.js',
|
||||||
filename: '[name].html',
|
filename: '[name].html',
|
||||||
...config.html,
|
...config.html,
|
||||||
templateParameters: resolveDefine(null, true)
|
templateParameters: resolveDefine(null, true),
|
||||||
|
mountElementId: config.mountElementId
|
||||||
};
|
};
|
||||||
htmlOptions.title = htmlOptions.title || 'fes.js';
|
|
||||||
|
|
||||||
|
|
||||||
if (isProd) {
|
if (isProd) {
|
||||||
Object.assign(htmlOptions, {
|
Object.assign(htmlOptions, {
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="<%= htmlWebpackPlugin.options.mountElementId %>"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -3,7 +3,7 @@ export default (api) => {
|
|||||||
api.describe({
|
api.describe({
|
||||||
key: 'mountElementId',
|
key: 'mountElementId',
|
||||||
config: {
|
config: {
|
||||||
default: '#app',
|
default: 'app',
|
||||||
schema(joi) {
|
schema(joi) {
|
||||||
return joi.string().allow('');
|
return joi.string().allow('');
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ export default function (api) {
|
|||||||
enableTitle: api.config.title !== false,
|
enableTitle: api.config.title !== false,
|
||||||
defaultTitle: api.config.title || '',
|
defaultTitle: api.config.title || '',
|
||||||
runtimePath,
|
runtimePath,
|
||||||
rootElement: api.config.mountElementId || '#app',
|
rootElement: `#${api.config.mountElementId || 'app'}`,
|
||||||
entryCode: (
|
entryCode: (
|
||||||
await api.applyPlugins({
|
await api.applyPlugins({
|
||||||
key: 'addEntryCode',
|
key: 'addEntryCode',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user