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.
39 lines
748 B
39 lines
748 B
import {createMutations} from "@/utils"
|
|
|
|
const state = {
|
|
show: false,
|
|
current: '',
|
|
list: []
|
|
}
|
|
|
|
const mutations = {
|
|
...createMutations(state),
|
|
add(state, src) {
|
|
if (state.list.some(i => i === src)) return
|
|
state.list.push(src)
|
|
},
|
|
del(state, src) {
|
|
const index = state.list.findIndex(i => i === src)
|
|
index > -1 && state.list.splice(index, 1)
|
|
}
|
|
}
|
|
|
|
const actions = {
|
|
open({commit}, src) {
|
|
commit('show', true)
|
|
commit('current', src)
|
|
commit('add', src)
|
|
},
|
|
close({commit}, src) {
|
|
commit('show', false)
|
|
commit('current', '')
|
|
commit('del', src)
|
|
}
|
|
}
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
mutations,
|
|
actions
|
|
}
|
|
|