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.
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 阅读论文标签数据
|
|
|
|
*/
|
|
|
|
export const state=()=>({
|
|
|
|
//已打开论文列表
|
|
|
|
read: { },
|
|
|
|
//激活的论文标签
|
|
|
|
activeName:''
|
|
|
|
})
|
|
|
|
export const mutations = {
|
|
|
|
//新建论文标签
|
|
|
|
open(state,item){
|
|
|
|
if(item.title in state.read){
|
|
|
|
mutations.choose(state,item.title)
|
|
|
|
}else{
|
|
|
|
Vue.set(state.read,item.title, item)
|
|
|
|
mutations.choose(state)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//关闭论文标签
|
|
|
|
close(state,title){
|
|
|
|
Vue.delete(state.read,title)
|
|
|
|
if(Object.keys(state.read).length>0&&state.activeName===title){
|
|
|
|
mutations.choose(state)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//选择论文标签
|
|
|
|
choose(state,title=Object.keys(state.read)[Object.keys(state.read).length-1]){
|
|
|
|
state.activeName=title
|
|
|
|
},
|
|
|
|
//滚动正文
|
|
|
|
scroll(state,scrollTop){
|
|
|
|
state.read[state.activeName].scrollTop=scrollTop
|
|
|
|
},
|
|
|
|
//查找状态
|
|
|
|
find(state,item){
|
|
|
|
state.read[state.activeName].find=item
|
|
|
|
}
|
|
|
|
}
|