I try to learn how i can create custom element for Shopware 6 although I cannot understand why we have to use the methods:
this.$emit('element-update', this.element);
in all SW Blocks?
All CMS element components should use the cms-element
mixin. The mixin has a model for the property element
which is bound to the element-update
event. By emitting this event with the value you update the property, as if you were using a child component with the form input binding v-model
. Since mutating props directly is considered an anti-pattern, this is a way to properly update it.