|
@@ -1,85 +0,0 @@
|
|
|
-<template>
|
|
|
|
|
- <!-- <div>项目的首页</div>
|
|
|
|
|
- <div>
|
|
|
|
|
- <div @click="handleChangeApp(1)">应用1</div>
|
|
|
|
|
- <div @click="handleChangeApp(2)">应用2</div>
|
|
|
|
|
- </div> -->
|
|
|
|
|
-
|
|
|
|
|
- <WujieVue
|
|
|
|
|
- width="100%"
|
|
|
|
|
- height="100%"
|
|
|
|
|
- name="child2"
|
|
|
|
|
- :url="url"
|
|
|
|
|
- :sync="true"
|
|
|
|
|
- :fetch="fetch"
|
|
|
|
|
- :props="props"
|
|
|
|
|
- :plugins="plugins"
|
|
|
|
|
- ></WujieVue>
|
|
|
|
|
-</template>
|
|
|
|
|
-<script setup>
|
|
|
|
|
-import { ref } from 'vue';
|
|
|
|
|
-
|
|
|
|
|
-const props = defineProps({
|
|
|
|
|
- url: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- request: true
|
|
|
|
|
- }
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-// const url = ref('http://localhost:4001/');
|
|
|
|
|
-
|
|
|
|
|
-const app1_plug = [
|
|
|
|
|
- {
|
|
|
|
|
- // 对css脚本动态的进行替换
|
|
|
|
|
- // code 为样式代码、url为样式的地址(内联样式为'')、base为子应用当前的地址
|
|
|
|
|
- cssLoader: (code, url, base) => {
|
|
|
|
|
- console.log('css-loader', url, code.slice(0, 50) + '...');
|
|
|
|
|
- return code;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- cssAfterLoaders: [
|
|
|
|
|
- //在加载html所有样式之后添加一个外联样式
|
|
|
|
|
- // { src: "https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" },
|
|
|
|
|
- //在加载html所有样式之后添加一个内联样式
|
|
|
|
|
- { content: 'body{background-color: blue; font-size: 15px;}' }
|
|
|
|
|
- ]
|
|
|
|
|
- }
|
|
|
|
|
-];
|
|
|
|
|
-
|
|
|
|
|
-const app2_plug = [
|
|
|
|
|
- {
|
|
|
|
|
- // 对css脚本动态的进行替换
|
|
|
|
|
- // code 为样式代码、url为样式的地址(内联样式为'')、base为子应用当前的地址
|
|
|
|
|
- cssLoader: (code, url, base) => {
|
|
|
|
|
- console.log('css-loader', url, code.slice(0, 50) + '...');
|
|
|
|
|
- return code;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- cssAfterLoaders: [
|
|
|
|
|
- //在加载html所有样式之后添加一个外联样式
|
|
|
|
|
- // { src: "https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" },
|
|
|
|
|
- //在加载html所有样式之后添加一个内联样式
|
|
|
|
|
- { content: 'body{background-color: red; font-size: 30px;}' }
|
|
|
|
|
- ]
|
|
|
|
|
- }
|
|
|
|
|
-];
|
|
|
|
|
-
|
|
|
|
|
-const plugins = ref(app1_plug);
|
|
|
|
|
-
|
|
|
|
|
-const handleChangeApp = (app) => {
|
|
|
|
|
- console.log(app, 'APP的ID');
|
|
|
|
|
-
|
|
|
|
|
- if (app === 1) {
|
|
|
|
|
- url.value = 'http://localhost:4000/';
|
|
|
|
|
- plugins.value = app1_plug;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (app === 2) {
|
|
|
|
|
- url.value = 'http://localhost:4001/';
|
|
|
|
|
- plugins.value = app2_plug;
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
-</script>
|
|
|
|
|
-<style></style>
|
|
|