Coder Social home page Coder Social logo

Comments (4)

junsen313 avatar junsen313 commented on September 23, 2024 1

自己debug了下,发现基座的MicroApp.vue组件销毁了,没有触发子应用的 vue实例销毁的生命周期(不知道是不是bug),自然子应用的路由影响还在。所以需要手动的销毁子应用的vue实例:

const subApp = new Vue({
    router,
    store,
    render: (h) => h(App),
}).$mount('#app');

// 子应用中监听卸载事件
window.addEventListener('unmount', function () {
    console.log('我被卸载了');
    subApp.$destroy();
});

这样修改后,暂时没发现报错了

from micro-app.

bailicangdu avatar bailicangdu commented on September 23, 2024

这个问题是因为popstate事件影响到所有应用,login子应用接收到事件判断 /goods/路由为非法路由则会兜底加载login的404页面,但此时应用已经被卸载了,导致出错,建议子应用的404在微前端环境去掉吧,统一使用基座应用的
image

from micro-app.

junsen313 avatar junsen313 commented on September 23, 2024

@bailicangdu 子应用已去掉404,暂不处理404情况;问题还是存在,基座左侧菜单来回切换,点浏览器返回,多切几次,还是会报类似错误,暂时没发现规律。demo已更新。

from micro-app.

bailicangdu avatar bailicangdu commented on September 23, 2024

👍

from micro-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.