首次提交
This commit is contained in:
48
chengduTestPlant/src/store/modules/iframe.js
Normal file
48
chengduTestPlant/src/store/modules/iframe.js
Normal file
@@ -0,0 +1,48 @@
|
||||
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
|
||||
Reference in New Issue
Block a user