| 1234567891011121314151617181920212223242526 |
- import { defineStore } from 'pinia'
- export const keepAliveStore = defineStore('keepAliveStore', {
- /** 持久化 **/
- persist: true,
- state: () => ({ list: [] }),
- actions: {
- /**
- * 添加浏览记录菜单
- * @param menu
- */
- add (name) {
- this.list.includes(name) || this.list.push(name)
- },
- /**
- * 清空浏览记录菜单(用户退出时候,必须调调用此菜单)
- */
- remove (name) {
- this.list = this.list.filter(v => {
- return v !== name
- })
- }
- }
- })
- export default keepAliveStore
|