Skip to content

Commit

Permalink
chore: 案例更新
Browse files Browse the repository at this point in the history
  • Loading branch information
bailicangdu committed Oct 24, 2021
1 parent 96e5f86 commit 8eaccda
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions docs/zh-cn/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ microApp.start({
credentials: 'include', // 请求时带上cookie
}

return fetch(url, Object.assign(options, config)).then((res) => {
return window.fetch(url, Object.assign(options, config)).then((res) => {
return res.text()
})
}
Expand Down Expand Up @@ -230,8 +230,8 @@ function mount () {

// 👇 将卸载操作放入 unmount 函数
function unmount () {
app.unmount()
history.destroy()
app?.unmount()
history?.destroy()
app = null
router = null
history = null
Expand Down Expand Up @@ -274,7 +274,7 @@ async function mount () {
function unmount () {
app?.destroy();
// 清空根元素,如果根元素不是app-root,根据实际情况调整
document.querySelector('app-root').innerHTML = '';
document.querySelector('app-root')?.innerHTML = '';
app = null;
}

Expand Down Expand Up @@ -317,8 +317,8 @@ function mount () {

// 👇 将卸载操作放入 unmount 函数
function unmount () {
app.unmount()
history.destroy()
app?.unmount()
history?.destroy()
app = null
router = null
history = null
Expand Down
2 changes: 1 addition & 1 deletion examples/children/angular11/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function mount () {
// 将卸载操作放入 unmount 函数
function unmount () {
app?.destroy();
// @ts-ignore
// @ts-ignore 清空根元素,如果根元素不是app-root,根据实际情况调整
document.querySelector('app-root')?.innerHTML = '';
app = null;
console.log('微应用child-angular11卸载了');
Expand Down
10 changes: 5 additions & 5 deletions examples/children/vite/src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createApp } from 'vue'
import * as VueRouter from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import App from './App.vue'
import Page1 from './pages/page1.vue'
import Page2 from './pages/page2.vue'
Expand All @@ -24,8 +24,8 @@ let router = null
let history = null
// 将渲染操作放入 mount 函数
function mount () {
history = VueRouter.createWebHashHistory('/micro-app/vite/')
router = VueRouter.createRouter({
history = createWebHashHistory('/micro-app/vite/')
router = createRouter({
history,
routes,
})
Expand All @@ -39,8 +39,8 @@ function mount () {

// 将卸载操作放入 unmount 函数
function unmount () {
app.unmount()
history.destroy()
app?.unmount()
history?.destroy()
app = null
router = null
history = null
Expand Down
4 changes: 2 additions & 2 deletions examples/children/vue3/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function mount () {

// 将卸载操作放入 unmount 函数
function unmount () {
app.unmount()
history.destroy()
app?.unmount()
history?.destroy()
app = null
router = null
history = null
Expand Down
2 changes: 1 addition & 1 deletion examples/children/vue3/src/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Home from './pages/page1.vue';
import Home from './pages/page1.vue'

const routes = [
{
Expand Down

0 comments on commit 8eaccda

Please sign in to comment.