revert visible
This commit is contained in:
parent
21166d0326
commit
8872674ba6
|
@ -4,12 +4,14 @@ type state = {
|
||||||
name?: string,
|
name?: string,
|
||||||
description?: string,
|
description?: string,
|
||||||
clickable: PromoScene[],
|
clickable: PromoScene[],
|
||||||
|
_visible: { id: number, is_enabled: boolean }[],
|
||||||
visible: PromoScene[],
|
visible: PromoScene[],
|
||||||
}
|
}
|
||||||
export const usePromoScene = defineStore('promo_scene', {
|
export const usePromoScene = defineStore('promo_scene', {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
clickable: [],
|
clickable: [],
|
||||||
|
_visible: [],
|
||||||
visible: [],
|
visible: [],
|
||||||
} as state
|
} as state
|
||||||
},
|
},
|
||||||
|
@ -22,7 +24,10 @@ export const usePromoScene = defineStore('promo_scene', {
|
||||||
this.clickable = data
|
this.clickable = data
|
||||||
},
|
},
|
||||||
setVisible(data: PromoScene[]) {
|
setVisible(data: PromoScene[]) {
|
||||||
this.visible = data
|
this._visible = data.slice(0).map(el => {
|
||||||
|
return { id: el.id, is_enabled: el.is_enabled ?? true }
|
||||||
|
})
|
||||||
|
this.visible = data.slice(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { useClickable } from './clickable'
|
import { useClickable } from './clickable'
|
||||||
|
import { usePromoScene } from './promo_scene'
|
||||||
|
|
||||||
export const usePromoSidebar = defineStore('promo_sidebar', {
|
export const usePromoSidebar = defineStore('promo_sidebar', {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -47,13 +48,18 @@ export const usePromoSidebar = defineStore('promo_sidebar', {
|
||||||
// this.target = undefined;
|
// this.target = undefined;
|
||||||
// this.loading = true;
|
// this.loading = true;
|
||||||
this.is_open = false;
|
this.is_open = false;
|
||||||
this.accordions = []
|
this.accordions = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeBtn() {
|
closeBtn() {
|
||||||
this.$reset;
|
this.$reset;
|
||||||
this.is_open = false;
|
this.is_open = false;
|
||||||
this.is_btn_open = false;
|
this.is_btn_open = false;
|
||||||
|
|
||||||
|
const sidebar_scene = usePromoScene()
|
||||||
|
sidebar_scene.visible.map(el => {
|
||||||
|
el.is_enabled = (sidebar_scene._visible.find(item => item.id == el.id) ?? { is_enabled: true }).is_enabled
|
||||||
|
})
|
||||||
},
|
},
|
||||||
toggleAccordion(name: string, newState = null) {
|
toggleAccordion(name: string, newState = null) {
|
||||||
if (name == 'obj' && this.accordions.includes('clickable')) this.toggleAccordion('clickable')
|
if (name == 'obj' && this.accordions.includes('clickable')) this.toggleAccordion('clickable')
|
||||||
|
|
Loading…
Reference in New Issue