|
|
@ -1,5 +1,6 @@
|
|
|
|
import Cookies from 'js-cookie';
|
|
|
|
import Cookies from 'js-cookie';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const app = {
|
|
|
|
const app = {
|
|
|
|
state: {
|
|
|
|
state: {
|
|
|
|
sidebar: {
|
|
|
|
sidebar: {
|
|
|
@ -19,11 +20,17 @@ const app = {
|
|
|
|
state.sidebar.opened = !state.sidebar.opened;
|
|
|
|
state.sidebar.opened = !state.sidebar.opened;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ADD_VISITED_VIEWS: (state, view) => {
|
|
|
|
ADD_VISITED_VIEWS: (state, view) => {
|
|
|
|
if (state.visitedViews.includes(view)) return
|
|
|
|
if (state.visitedViews.some(v => v.path === view.path)) return
|
|
|
|
state.visitedViews.push(view)
|
|
|
|
state.visitedViews.push({ name: view.name, path: view.path })
|
|
|
|
},
|
|
|
|
},
|
|
|
|
DEL_VISITED_VIEWS: (state, view) => {
|
|
|
|
DEL_VISITED_VIEWS: (state, view) => {
|
|
|
|
const index = state.visitedViews.indexOf(view)
|
|
|
|
let index
|
|
|
|
|
|
|
|
for (const [i, v] of state.visitedViews.entries()) {
|
|
|
|
|
|
|
|
if (v.path === view.path) {
|
|
|
|
|
|
|
|
index = i
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
state.visitedViews.splice(index, 1)
|
|
|
|
state.visitedViews.splice(index, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|