保存产品在管理员界面中应使用哪个事件?

huangapple go评论47阅读模式
英文:

Which event should be using for save product in administrator interface?

问题

我想在管理员编辑单个产品时添加一些调整。
我应该使用哪个事件(在保存产品时)?

能给我一个示例吗?

英文:

I want add some adjustments when I edit a single product in administrator.
Which event should I use for that (on save product)?

Could you give me an example?

答案1

得分: 2

你可以想要重写 sw-product-detail 组件和 onSave 方法,以在调用原始方法之前进行一些更改。

Shopware.Component.override('sw-product-detail', {
    methods: {
        onSave() {
            this.product.somePropertyToChange = 'foobar';
            
            this.$super('onSave');
        }
    }
});
英文:

You may want to override the sw-product-detail component and the onSave method to make some changes prior to calling the original method.

Shopware.Component.override('sw-product-detail', {
    methods: {
        onSave() {
            this.product.somePropertyToChange = 'foobar';
            
            this.$super('onSave');
        }
    }
});

huangapple
  • 本文由 发表于 2023年4月11日 15:25:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/75983391.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定