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.
26 lines
529 B
26 lines
529 B
6 months ago
|
|
||
|
|
||
|
import { defineStore } from 'pinia';
|
||
|
export const useKeepAlive = defineStore({
|
||
|
id: 'keepAlive',
|
||
|
state() {
|
||
|
return { keepAlive: [] };
|
||
|
},
|
||
|
getters: {
|
||
|
getKeepAlive: (state: any) => state.keepAlive,
|
||
|
},
|
||
|
actions: {
|
||
|
clearKeepAlive() {
|
||
|
this.keepAlive = [];
|
||
|
},
|
||
|
removeKeepAlive(index: number) {
|
||
|
this.keepAlive.splice(index, 1);
|
||
|
},
|
||
|
addKeepAlive(val: String) {
|
||
|
if (val && this.keepAlive.findIndex((x) => x === val) === -1) {
|
||
|
this.keepAlive.push(val);
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
});
|