Files
cdTestPlant3/chengduTestPlant/src/store/modules/iframe.js
2023-06-04 20:01:58 +08:00

49 lines
920 B
JavaScript

import { defineStore } from "pinia"
const useIframeStore = defineStore("iframe", {
state: () => ({
iframes: [],
name: null,
show: true
}),
getters: {
currentIframe(state) {
return { ...state }
}
},
actions: {
addIframe(component) {
if (!this.iframes.includes(component)) {
this.iframes.push(component)
}
},
removeIframe(component) {
const idx = this.iframes.indexOf(component)
if (idx !== -1) {
this.iframes.splice(idx, 1)
}
},
display() {
this.show = true
},
hidden() {
this.show = false
},
setName(name) {
this.name = name
},
clearIframe() {
this.iframes = []
}
}
})
export default useIframeStore