Skip to content

Commit

Permalink
chore: demo update
Browse files Browse the repository at this point in the history
  • Loading branch information
bailicangdu committed Oct 20, 2021
1 parent 1546ab9 commit c52a482
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/zh-cn/changelog.md
Expand Up @@ -22,6 +22,7 @@
- **Update**

- 📝 优化了在非inline模式下,module类型script元素的执行方式
- 📝 优化了报错日志信息,增加应用名称


### 0.4.0
Expand Down
@@ -1,2 +1,3 @@
<p>page2 works!</p>
<div class="test-btn">test</div>
<a routerLink="/" routerLinkActive="active">返回home</a>
12 changes: 12 additions & 0 deletions examples/children/angular11/src/app/second/second.component.less
@@ -0,0 +1,12 @@
.test-btn {
height: 50px;
width: 100px;
background-color: red;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 20px;
font-weight: bolder;
}
13 changes: 13 additions & 0 deletions examples/children/react16/src/pages/page2/page2.css
@@ -1,3 +1,16 @@
.page2 {
color: red;
}

.test-btn {
height: 50px;
width: 100px;
background-color: red;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 20px;
font-weight: bolder;
}
1 change: 1 addition & 0 deletions examples/children/react16/src/pages/page2/page2.js
Expand Up @@ -263,6 +263,7 @@ const Page2 = () => {
</Button>
</Form.Item>
</Form>
<div className="test-btn">test</div>
</div>
);
};
Expand Down
16 changes: 15 additions & 1 deletion examples/children/vite/src/pages/page2.vue
@@ -1,9 +1,23 @@
<template>
<div>
page2
<p>page2</p>
<div class="test-btn-vite">test</div>
<router-link to="/">Go to Home</router-link>
</div>
</template>

<style>
.test-btn-vite {
height: 50px;
width: 100px;
background-color: red;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 20px;
font-weight: bolder;
margin: 0 auto;
}
</style>
14 changes: 14 additions & 0 deletions examples/children/vue2/src/pages/page2.vue
Expand Up @@ -58,6 +58,7 @@
<el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
</span>
</el-dialog>
<div class="test-btn">test</div>
</div>
</template>

Expand Down Expand Up @@ -126,4 +127,17 @@ export default {
.page2 {
width: 500px;
}
.test-btn {
height: 50px;
width: 100px;
background-color: red;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 20px;
font-weight: bolder;
}
</style>
6 changes: 5 additions & 1 deletion examples/children/vue3/src/main.js
Expand Up @@ -22,10 +22,12 @@ import App from './App.vue'

let app = null
let router = null
let history = null
// 将渲染操作放入 mount 函数
function mount () {
history = createWebHistory(window.__MICRO_APP_BASE_ROUTE__ || '/micro-app/vue3/')
router = createRouter({
history: createWebHistory(window.__MICRO_APP_BASE_ROUTE__ || '/micro-app/vue3/'),
history,
routes,
})

Expand All @@ -40,8 +42,10 @@ function mount () {
// 将卸载操作放入 unmount 函数
function unmount () {
app.unmount()
history.destroy()
app = null
router = null
history = null
console.log('微应用child-vue3卸载了')
}

Expand Down
14 changes: 14 additions & 0 deletions examples/children/vue3/src/pages/page2.vue
Expand Up @@ -47,6 +47,7 @@
<router-link to="/">
<el-button type="primary" plain>返回首页</el-button>
</router-link>
<div class="test-btn">test</div>
</div>
</template>

Expand Down Expand Up @@ -81,4 +82,17 @@
background: #fff;
padding: 40px;
}
.test-btn {
height: 50px;
width: 100px;
background-color: red;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 20px;
font-weight: bolder;
}
</style>

0 comments on commit c52a482

Please sign in to comment.