英文:
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');
}
}
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论