我想从我覆盖的 sw-component 继承道具

I want to inherit props from a sw-component which I’m overriding

我想从我覆盖的 sw 组件继承道具。 我知道我可以从注册表中获取组件,但我愿意继承的部分来自于 default() 属性 一个 prop.

我们想在 link 配置中添加更多选项,而不必复制覆盖 buttonConfig.default()

的整个 return 部分
import template from './sw-text-editor.html.twig';
import './sw-text-editor.scss';

const { Component } = Shopware;

Component.register('sw-text-editor', {
    template,

    props: {

        buttonConfig: {
            type: Array,
            required: false,
            default() {
                return [
                    {
                        type: 'link',
                        title: this.$tc('sw-text-editor-toolbar.title.link'),
                        icon: 'default-text-editor-link',
                        expanded: false,
                        newTab: false,
                        displayAsButton: false,
                        buttonVariant: '',
                        buttonVariantList: [
                            {
                                id: 'primary',
                                name: this.$tc('sw-text-editor-toolbar.link.buttonVariantPrimary')
                            },
                            {
                                id: 'secondary',
                                name: this.$tc('sw-text-editor-toolbar.link.buttonVariantSecondary')
                            },
                            {
                                id: 'primary-sm',
                                name: this.$tc('sw-text-editor-toolbar.link.buttonVariantPrimarySmall')
                            },
                            {
                                id: 'secondary-sm',
                                name: this.$tc('sw-text-editor-toolbar.link.buttonVariantSecondarySmall')
                            }
                        ],
                        value: '',
                        tag: 'a'
                    },
                ];
            }
        }
    },
});

这可以通过覆盖 createdComponent 方法来完成。调用父 createdComponent 方法是通过 this.$super('createdComponent')

完成的