On the ineffectiveness of this. $router. Replace ({path: ‘/’}) refresh in vue3.0

Time:2020-5-8

First, define the required variables in the store for initialization, and then define a method. After logging in successfully, you need to call the method of storing data in the store directly before jumping to page B on page a, which can be used globally

Such as the above, the problem, Baidu for a long time, thanks to the group.

The solution of Vue using less error reporting install less loader


cnpm install less less-loader --save-dev

App.vue is the root file of all xxx.vue files

So the bottom of webapp is usually configured here

Addition of H5
< header > Title < / header >
< main > subject content < / main >
< footer > fixed bottom content < / footer >
So the footer is usually not used at the bottom

Elements are arranged horizontally at the bottom

<div>
< div > take out < / div >
< div > search < / div >
< div > order < / div >
< div > My < / div >
</div>

.myfooterbox {
width: 100%;
display: flex;
justify-content: space-between;
position: fixed;
bottom: 0;
left: 0;
}

PS = = > if the width of an element is its own width.
Justify content: space between; may not work.

Click route jump


this.$router.push({ path: "/search" });

To add background color to the currently clicked element is also to add a class with the help of binocular operation if it is true

.on {
background: pink;
}

< div @ Click = "handlersell": class = "{on: '/' = = $route. Path}" > take out < / div >
< div @ Click = "handlersearch": class = "{on: '/ search' = = = $route. Path}" > search < / div >

Route jump

< div @ Click = "handlersell": class = "{on: '/' = = $route. Path}" > take out < / div >
< div @ Click = "handlersearch": class = "{on: '/ search' = = $route. Path}" > search < / div >

methods: {
handlersell() {
this.$router.push({ path: "/" });
},
handlersearch() {
this.$router.push({ path: "/search" });
},
}

Replace is used after optimization

< div @ Click = "handlergo ('/'): class =" {on: '/' = = $route. Path} "> take out < / div >
< div @ Click = "handlergo ('/ search'): class =" {on: '/ search' = = = $route. Path} "> search < / div >

handlergo(path) {
this.$router.replace(path);
}

The above is the whole content of this article. I hope it will help you in your study, and I hope you can support developepaer more.