File tree 6 files changed +48
-21
lines changed
6 files changed +48
-21
lines changed Original file line number Diff line number Diff line change 12
12
"core-js" : " ^3.8.3" ,
13
13
"register-service-worker" : " ^1.7.2" ,
14
14
"vue" : " ^2.6.14" ,
15
- "vuex" : " ^3.6.2"
15
+ "vuex" : " ^3.6.2" ,
16
+ "vuex-persist" : " ^3.1.3"
16
17
},
17
18
"devDependencies" : {
18
19
"@fontsource/inter" : " ^4.5.11" ,
Original file line number Diff line number Diff line change @@ -35,20 +35,23 @@ export default Vue.extend({
35
35
const tabNumber = Number (this .$route .params .tab )
36
36
const isValidTabNumber = tabNumber >= 1 && tabNumber <= this .$store .state .tabs .length
37
37
if (! isValidTabNumber ) {
38
- this .$router .push (' /1 ' )
38
+ this .$router .push (` /1/${ this . $store . state . tabs [ 0 ]. path } ` )
39
39
}
40
40
},
41
41
deep: true ,
42
42
immediate: true ,
43
43
},
44
44
' $route.path' : {
45
45
handler () {
46
+ const tabNumber = Number (this .$route .params .tab )
46
47
const line = this .$route .params .line
47
48
const stop = this .$route .params .stop
48
- this .$store .commit (' setTab' , {
49
- idx: Number (this .$route .params .tab ) - 1 ,
50
- tab: { line , stop },
51
- })
49
+ if (tabNumber && ! isNaN (tabNumber )) {
50
+ this .$store .commit (' setTab' , {
51
+ idx: tabNumber - 1 ,
52
+ tab: { line , stop },
53
+ })
54
+ }
52
55
},
53
56
deep: true ,
54
57
immediate: true ,
Original file line number Diff line number Diff line change 1
1
import Vue from 'vue'
2
2
import VueRouter from 'vue-router'
3
3
import Vuex from 'vuex'
4
+ import VuexPersistence from 'vuex-persist'
4
5
import './registerServiceWorker'
5
6
import App from './App.vue'
6
7
@@ -9,7 +10,7 @@ Vue.use(VueRouter)
9
10
Vue . use ( Vuex )
10
11
11
12
const routes = [
12
- { path : '/' , redirect : '/1' } ,
13
+ { path : '/' , component : App } ,
13
14
{ path : '/:tab' , component : App } ,
14
15
{ path : '/:tab/:line' , component : App } ,
15
16
{ path : '/:tab/:line/:stop' , component : App } ,
@@ -49,6 +50,7 @@ const store = new Vuex.Store({
49
50
state . tabs = newTabs
50
51
} ,
51
52
} ,
53
+ plugins : [ new VuexPersistence ( ) . plugin ] ,
52
54
} )
53
55
54
56
new Vue ( {
Original file line number Diff line number Diff line change @@ -22,11 +22,6 @@ import { getLinesByCategory } from '@/utils/localstore/lines'
22
22
export default Vue .extend ({
23
23
name: ' TabPageNew' ,
24
24
components: { LineIcon },
25
- methods: {
26
- redirectToHome () {
27
- this .$router .push (' /1' )
28
- },
29
- },
30
25
computed: {
31
26
linesByCategory () {
32
27
return getLinesByCategory ()
Original file line number Diff line number Diff line change 4389
4389
" flatted" " ^3.1.0"
4390
4390
" rimraf" " ^3.0.2"
4391
4391
4392
- " flatted@^3.1.0 " :
4392
+ " flatted@^3.0.5 " , "flatted@^3. 1.0":
4393
4393
" integrity" " sha512-0sQoMh9s0BYsm+12Huy/rkKxVu4R1+r96YX5cG44rHV0pQ6iC3Q+mkoMFaGWObMFYQxCVT+ssG1ksneA2MI9KQ=="
4394
4394
" resolved" " https://registry.npmmirror.com/flatted/-/flatted-3.2.6.tgz"
4395
4395
" version" " 3.2.6"
8490
8490
" @vue/compiler-sfc" " 2.7.8"
8491
8491
" csstype" " ^3.1.0"
8492
8492
8493
- " vuex@^3.6.2 " :
8493
+ " vuex-persist@^3.1.3 " :
8494
+ " integrity" " sha512-QWOpP4SxmJDC5Y1+0+Yl/F4n7z27syd1St/oP+IYCGe0X0GFio0Zan6kngZFufdIhJm+5dFGDo3VG5kdkCGeRQ=="
8495
+ " resolved" " https://registry.npmjs.org/vuex-persist/-/vuex-persist-3.1.3.tgz"
8496
+ " version" " 3.1.3"
8497
+ dependencies :
8498
+ " deepmerge" " ^4.2.2"
8499
+ " flatted" " ^3.0.5"
8500
+
8501
+ " vuex@^3.6.2" , "vuex@>=2.5":
8494
8502
" integrity" " sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
8495
8503
" resolved" " https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz"
8496
8504
" version" " 3.6.2"
You can’t perform that action at this time.
0 commit comments