How to initialize switching routing data in vuex

topic description

A single-page application for vue family buckets, using vuex for the first time. The problem now is that on page A, one state of moduleA is 1, and now I change 1 to 2;
when I switch to page B and back to page A, the state is still 2. Is there any way to make state 1

every time you enter the A page?
Mar.28,2021

store all the data in the store of vuex. After the interview, first take out the data of store to initialize, and then render


1. Do you want to enter page 1 or render 1
2 for the first time? If entering the page is 1, you should judge the route in the beforeEach of router, and then deal with
3. If it is 1 when rendering, then commit it and change state to 1 in created

Menu