Skip to content

Feature request: remove the global style of last page when navigate to a new page when using vue-router. #1194

@huyaxiong

Description

@huyaxiong

For instance I have codes like this:

router.js

import Vue from 'vue';
import VueRouter from 'vue-router';
const A = resolve => require(['./component/a.vue'], resolve);
const B = resolve => require(['./component/b.vue'], resolve);

Vue.use(VueRouter);

const routes = [
    {
        path: '/a', component: A,
    },
    {
        path: '/b', component: B,
    },
];

let router = new VueRouter({routes});
export default router;

a.vue

<style lang="sass">

body {
    background-color: #1F2C36;
}

</style>

When I navigate to the route /a first, And then I navigate to the route /b, the background color doesn't change, What I want is that the global style defined in a.vue should be removed when I navigated to another page.And I read all the document seems that there were no solution for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions