You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
const state = {
|
|
|
|
recentPages: [],
|
|
|
|
isRecentOpen:false,
|
|
|
|
}
|
|
|
|
|
|
|
|
const mutations = {
|
|
|
|
|
|
|
|
addRecent(state, item) {
|
|
|
|
|
|
|
|
let temp;
|
|
|
|
state.recentPages.forEach((unit,index)=>{
|
|
|
|
if(unit.path == item.path){
|
|
|
|
temp = unit;
|
|
|
|
temp.active = true;
|
|
|
|
}else{
|
|
|
|
unit.active = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (!temp){
|
|
|
|
item.active = true;
|
|
|
|
state.recentPages.push(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
openRecent(state){
|
|
|
|
state.isRecentOpen = true;
|
|
|
|
},
|
|
|
|
closeRecent(state){
|
|
|
|
state.isRecentOpen = false;
|
|
|
|
},
|
|
|
|
removeRecent(state, item) {
|
|
|
|
let i = state.recentPages.findIndex(unit => unit.path == item.path);
|
|
|
|
state.recentPages.splice(i, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
namespaced: true,
|
|
|
|
state,
|
|
|
|
mutations,
|
|
|
|
}
|