feat(webapp): group categories on posts

This commit is contained in:
Moriz Wahl 2023-04-25 12:35:46 +02:00
parent e2667a1a98
commit 3244f3f86d
2 changed files with 264 additions and 248 deletions

View File

@ -43,6 +43,13 @@ export default {
selectedCategoryIds: this.existingCategoryIds,
}
},
watch: {
existingCategoryIds() {
console.log('existingCategoryIds', this.selectedCategoryIds)
if (!this.selectedCategoryIds.length)
this.selectedCategoryIds = this.existingCategoryIds
},
},
computed: {
selectedCount() {
return this.selectedCategoryIds.length

View File

@ -138,7 +138,7 @@ export default {
imageAspectRatio,
imageType,
imageBlurred,
categoryIds: categories ? categories.map((category) => category.id) : [],
categoryIds: categories ? categories.map((category) => category.id) : []
},
formSchema: {
title: { required: true, min: 3, max: 100 },
@ -177,6 +177,15 @@ export default {
groupName() {
return this.group && this.group.name
},
groupCategories() {
return this.group && this.group.categories
},
},
watch: {
groupCategories() {
console.log('groupCategories', this.groupCategories)
if (!this.formData.categoryIds && this.groupCategories) this.formData.categoryIds = this.groupCategories
},
},
methods: {
submit() {