【问题标题】:What means the "element-update" in Shopware 6?Shopware 6 中的“元素更新”是什么意思?
【发布时间】:2022-11-19 18:19:16
【问题描述】:

我尝试学习如何为 Shopware 6 创建自定义元素 虽然我不明白为什么我们必须使用这些方法:

this.$emit('element-update', this.element);

在所有 SW 块中?

【问题讨论】:

    标签: shopware6


    【解决方案1】:

    所有 CMS 元素组件都应使用 cms-element mixin。 mixin 有一个属性模型 element 绑定到 element-update 事件。通过使用您更新属性的值发出此事件,就像您使用具有表单输入绑定 v-model 的子组件一样。由于mutating props directly is considered an anti-pattern,这是一种正确更新它的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-14
      • 2012-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-17
      • 1970-01-01
      相关资源
      最近更新 更多