|
|
@ -1,5 +1,6 @@
|
|
|
|
import { getStore, setStore } from "../../utils/store";
|
|
|
|
import {getStore, setStore} from "../../utils/store";
|
|
|
|
import * as types from "../mutation-types";
|
|
|
|
import * as types from "../mutation-types";
|
|
|
|
|
|
|
|
import store from "@/store";
|
|
|
|
|
|
|
|
|
|
|
|
const state = {
|
|
|
|
const state = {
|
|
|
|
sidebar: {
|
|
|
|
sidebar: {
|
|
|
@ -16,16 +17,16 @@ const getters = {
|
|
|
|
|
|
|
|
|
|
|
|
// actions
|
|
|
|
// actions
|
|
|
|
const actions = {
|
|
|
|
const actions = {
|
|
|
|
ToggleSideBar({ commit }) {
|
|
|
|
ToggleSideBar({commit}) {
|
|
|
|
commit(types.TOGGLE_SIDEBAR);
|
|
|
|
commit(types.TOGGLE_SIDEBAR);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ShowSideBar({ commit }) {
|
|
|
|
ShowSideBar({commit}) {
|
|
|
|
commit(types.SHOW_SIDEBAR);
|
|
|
|
commit(types.SHOW_SIDEBAR);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
addVisitedViews({ commit }, view) {
|
|
|
|
addVisitedViews({commit}, view) {
|
|
|
|
commit(types.ADD_VISITED_VIEWS, view);
|
|
|
|
commit(types.ADD_VISITED_VIEWS, view);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
delVisitedViews({ commit, state }, view) {
|
|
|
|
delVisitedViews({commit, state}, view) {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
commit(types.DEL_VISITED_VIEWS, view);
|
|
|
|
commit(types.DEL_VISITED_VIEWS, view);
|
|
|
|
resolve([...state.visitedViews]);
|
|
|
|
resolve([...state.visitedViews]);
|
|
|
@ -51,7 +52,7 @@ const mutations = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[types.ADD_VISITED_VIEWS](state, view) {
|
|
|
|
[types.ADD_VISITED_VIEWS](state, view) {
|
|
|
|
if (state.visitedViews.some(v => v.path === view.path)) return;
|
|
|
|
if (state.visitedViews.some(v => v.path === view.path)) return;
|
|
|
|
state.visitedViews.push({ name: view.name, path: view.path });
|
|
|
|
state.visitedViews.push({name: view.name, path: view.path});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[types.DEL_VISITED_VIEWS](state, view) {
|
|
|
|
[types.DEL_VISITED_VIEWS](state, view) {
|
|
|
|
let index;
|
|
|
|
let index;
|
|
|
@ -65,9 +66,11 @@ const mutations = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
state,
|
|
|
|
state,
|
|
|
|
getters,
|
|
|
|
getters,
|
|
|
|
actions,
|
|
|
|
actions,
|
|
|
|
mutations
|
|
|
|
mutations,
|
|
|
|
};
|
|
|
|
};
|
|
|
|