|
@@ -1,11 +1,11 @@
|
|
const tagsView = {
|
|
const tagsView = {
|
|
state: {
|
|
state: {
|
|
- visitedViews: []
|
|
|
|
|
|
+ visitedViews: [],
|
|
|
|
+ isBack: false,
|
|
// cachedViews: []
|
|
// cachedViews: []
|
|
},
|
|
},
|
|
mutations: {
|
|
mutations: {
|
|
ADD_VISITED_VIEWS: (state, view) => {
|
|
ADD_VISITED_VIEWS: (state, view) => {
|
|
- console.log(view)
|
|
|
|
if (state.visitedViews.some(v => v.path === view.path)) {
|
|
if (state.visitedViews.some(v => v.path === view.path)) {
|
|
state.visitedViews.forEach(v => {
|
|
state.visitedViews.forEach(v => {
|
|
if (v.path === view.path) {
|
|
if (v.path === view.path) {
|
|
@@ -67,6 +67,9 @@ const tagsView = {
|
|
DEL_ALL_VIEWS: (state) => {
|
|
DEL_ALL_VIEWS: (state) => {
|
|
state.visitedViews = []
|
|
state.visitedViews = []
|
|
// state.cachedViews = []
|
|
// state.cachedViews = []
|
|
|
|
+ },
|
|
|
|
+ SET_IS_BACK: (state, isBack) => {
|
|
|
|
+ state.isBack = isBack
|
|
}
|
|
}
|
|
},
|
|
},
|
|
actions: {
|
|
actions: {
|
|
@@ -75,6 +78,7 @@ const tagsView = {
|
|
},
|
|
},
|
|
delVisitedViews ({ commit, state }, view) {
|
|
delVisitedViews ({ commit, state }, view) {
|
|
return new Promise((resolve) => {
|
|
return new Promise((resolve) => {
|
|
|
|
+ commit('SET_IS_BACK', !view.dontNeedSave)
|
|
commit('DEL_VISITED_VIEWS', view)
|
|
commit('DEL_VISITED_VIEWS', view)
|
|
resolve([...state.visitedViews])
|
|
resolve([...state.visitedViews])
|
|
})
|
|
})
|