perf[tags-view]:refine the style && format code

This commit is contained in:
Pan
2017-12-13 18:33:12 +08:00
parent b6d97f1806
commit 4d3bbae183
2 changed files with 174 additions and 172 deletions

View File

@@ -30,17 +30,17 @@ const tagsView = {
}
}
},
DEL_OTHER_VIEWS: (state, view) => {
DEL_OTHERS_VIEWS: (state, view) => {
for (const [i, v] of state.visitedViews.entries()) {
if (v.path === view.path) {
state.visitedViews = [].concat(state.visitedViews.slice(i, i + 1))
state.visitedViews = state.visitedViews.slice(i, i + 1)
break
}
}
for (const i of state.cachedViews) {
if (i === view.name) {
const index = state.cachedViews.indexOf(i)
state.cachedViews = [].concat(state.cachedViews.slice(index, i + 1))
state.cachedViews = state.cachedViews.slice(index, i + 1)
break
}
}
@@ -60,9 +60,9 @@ const tagsView = {
resolve([...state.visitedViews])
})
},
delOtherViews({ commit, state }, view) {
delOthersViews({ commit, state }, view) {
return new Promise((resolve) => {
commit('DEL_OTHER_VIEWS', view)
commit('DEL_OTHERS_VIEWS', view)
resolve([...state.visitedViews])
})
},