Commit ce5391b1 by Hao

add

parent 2c958c2d
if (window.__POWERED_BY_QIANKUN__) {
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
}
\ No newline at end of file
...@@ -16,7 +16,6 @@ service.interceptors.request.use( ...@@ -16,7 +16,6 @@ service.interceptors.request.use(
config.headers["tenant-id"] = tenantid; config.headers["tenant-id"] = tenantid;
// (config.headers["tenantName"] = "master"); // (config.headers["tenantName"] = "master");
if (config.method == "get") { if (config.method == "get") {
if (config.url.indexOf("sys/dict/getDictItems") < 0) { if (config.url.indexOf("sys/dict/getDictItems") < 0) {
config.params = { config.params = {
......
...@@ -4,6 +4,37 @@ import Antd from "ant-design-vue"; ...@@ -4,6 +4,37 @@ import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.css"; import "ant-design-vue/dist/antd.css";
Vue.use(Antd); Vue.use(Antd);
Vue.config.productionTip = false; Vue.config.productionTip = false;
new Vue({ let router=null;
let instance = null;
function render(props = {}) {
const { container } = props;
// router = new VueRouter({
// base: window.__POWERED_BY_QIANKUN__ ? '/app-vue/' : '/',
// mode: 'history',
// routes,
// });
instance = new Vue({
render: (h) => h(shopHome), render: (h) => h(shopHome),
}).$mount("#app"); }).$mount(container ? container.querySelector('#app') : '#app');
}
if (!window.__POWERED_BY_QIANKUN__) {
render();
}
export async function bootstrap() {
console.log('[vue] vue app bootstraped');
}
export async function mount(props) {
console.log('[vue] props from main framework', props);
render(props);
}
export async function unmount() {
instance.$destroy();
instance.$el.innerHTML = '';
instance = null;
router = null;
}
// new Vue({
// render: (h) => h(shopHome),
// }).$mount("#app");
const path = require("path"); const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin");
const data = require("./mock.js"); const data = require("./mock.js");
const { name } = require('./package');
module.exports = { module.exports = {
lintOnSave: false, lintOnSave: false,
// 多页面配置 // 多页面配置
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
template: "public/index.html", template: "public/index.html",
}, },
// 管理入口 // 管理入口
index: { appVue: {
entry: "test/shopHome.js", entry: "test/shopHome.js",
template: "public/index.html", template: "public/index.html",
}, },
...@@ -27,8 +27,10 @@ module.exports = { ...@@ -27,8 +27,10 @@ module.exports = {
template: "public/index.html", template: "public/index.html",
}, },
}, },
// configureWebpack是对象就是合入,是方法就直接修改配置
devServer: { devServer: {
headers:{
"Access-Control-Allow-Origin": "*",
},
after: (app) => { after: (app) => {
if (!app) { if (!app) {
throw new Error("webpack-dev-server is not defined"); throw new Error("webpack-dev-server is not defined");
...@@ -59,5 +61,11 @@ module.exports = { ...@@ -59,5 +61,11 @@ module.exports = {
]) ])
); );
} }
config.output = {
...config.output,
library: `${name}-[name]`,
libraryTarget: "umd", //把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${name}`, // webpack 5 需要把 jsonpFunction 替换成 chunkLoadingGlobal
};
}, },
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment