"use strict";const e=require("../../../../common/vendor.js"),t={name:"uniCollapse",emits:["change","activeItem","input","update:modelValue"],props:{value:{type:[String,Array],default:""},modelValue:{type:[String,Array],default:""},accordion:{type:[Boolean,String],default:!1}},data:()=>({}),computed:{dataValue(){let e="string"==typeof this.value&&""===this.value||Array.isArray(this.value)&&0===this.value.length;"string"==typeof this.modelValue&&""===this.modelValue||Array.isArray(this.modelValue)&&this.modelValue.length;return e?this.modelValue:this.value}},watch:{dataValue(e){this.setOpen(e)}},created(){this.childrens=[],this.names=[]},mounted(){this.$nextTick((()=>{this.setOpen(this.dataValue)}))},methods:{setOpen(e){let t="string"==typeof e,i=Array.isArray(e);this.childrens.forEach(((a,n)=>{if(t&&e===a.nameSync){if(!this.accordion)return void console.warn("accordion 属性为 false ,v-model 类型应该为 array");a.isOpen=!0}i&&e.forEach((e=>{if(e===a.nameSync){if(this.accordion)return void console.warn("accordion 属性为 true ,v-model 类型应该为 string");a.isOpen=!0}}))})),this.emit(e)},setAccordion(e){this.accordion&&this.childrens.forEach(((t,i)=>{e!==t&&(t.isOpen=!1)}))},resize(){this.childrens.forEach(((e,t)=>{e.getCollapseHeight()}))},onChange(e,t){let i=[];this.accordion?i=e?t.nameSync:"":this.childrens.forEach(((e,t)=>{e.isOpen&&i.push(e.nameSync)})),this.$emit("change",i),this.emit(i)},emit(e){this.$emit("input",e),this.$emit("update:modelValue",e)}}};const i=e._export_sfc(t,[["render",function(e,t,i,a,n,s){return{}}]]);wx.createComponent(i);
