Collapse inner items when parent item was closed

This commit is contained in:
Angelina Filippova 2020-06-24 21:41:27 +03:00
parent 84c6319a1f
commit acf9012979
2 changed files with 5 additions and 1 deletions

View file

@ -188,6 +188,9 @@ export default {
} }
}, },
methods: { methods: {
collapse() {
this.showPackContent = []
},
deletePack() { deletePack() {
this.$confirm('This will delete the pack, are you sure?', 'Warning', { this.$confirm('This will delete the pack, are you sure?', 'Warning', {
confirmButtonText: 'Yes, delete the pack', confirmButtonText: 'Yes, delete the pack',

View file

@ -33,7 +33,7 @@
</el-form-item> </el-form-item>
<el-form-item v-if="Object.keys(localPacks).length > 0" :label="$t('emoji.packs')"> <el-form-item v-if="Object.keys(localPacks).length > 0" :label="$t('emoji.packs')">
<el-collapse v-for="(pack, name) in localPacks" :key="name" v-model="activeLocalPack" accordion @change="setActiveTab"> <el-collapse v-for="(pack, name) in localPacks" :key="name" v-model="activeLocalPack" accordion @change="setActiveTab">
<local-emoji-pack :name="name" :pack="pack" :host="$store.getters.authHost" :is-local="true" /> <local-emoji-pack ref="localEmojiPack" :name="name" :pack="pack" :host="$store.getters.authHost" :is-local="true" />
</el-collapse> </el-collapse>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -185,6 +185,7 @@ export default {
}) })
}, },
setActiveTab(activeTab) { setActiveTab(activeTab) {
this.$refs.localEmojiPack.forEach(el => el.collapse())
this.$store.dispatch('SetActiveTab', activeTab) this.$store.dispatch('SetActiveTab', activeTab)
} }
} }