UNPKG

@fmdevui/fm-dev

Version:

Page level components developed based on Element Plus.

32 lines (28 loc) 796 B
'use strict'; var pinia = require('pinia'); const useKeepALiveNames = pinia.defineStore("keepALiveNames", { state: () => ({ keepAliveNames: [], cachedViews: [] }), actions: { async setCacheKeepAlive(data) { this.keepAliveNames = data; }, async addCachedView(view) { if (view.meta.isKeepAlive) this.cachedViews?.push(view.name); }, async delCachedView(view) { const index = this.cachedViews.indexOf(view.name); if (index > -1) this.cachedViews.splice(index, 1); }, async delOthersCachedViews(view) { if (view.meta.isKeepAlive) this.cachedViews = [view.name]; else this.cachedViews = []; }, async delAllCachedViews() { this.cachedViews = []; } } }); exports.useKeepALiveNames = useKeepALiveNames;