SW-Text-编辑器字段不以config字段为单位
我正在尝试将Wysiwyg字段添加给我的CMS元素作为配置字段的SW-Text-Edtior组件,但根本没有显示。如果我尝试一个SW-Text-Field而不是SW-Text-编辑器组件,则确实会显示。如果我缺少某些内容,我似乎在文档中找不到它。
我的代码: config/sw-cms-el-config-collapse.html.twig
{% block sw_cms_element_collapse_config %}
<sw-text-editor
v-model="blockContent"
:allow-inline-data-mapping="true"
sanitize-input
@element-update="onElementUpdate">
</sw-text-field>
{% endblock %}
config/index.js
import template from './sw-cms-el-config-collapse.html.twig';
Shopware.Component.register('sw-cms-el-config-collapse', {
template,
mixins: ['cms-element'],
computed: {
blockContent: {
get() {
return this.element.config.blockContent.value;
},
set(value) {
this.element.config.blockContent.value = value;
},
},
},
created() {
this.createdComponent();
},
methods: {
createdComponent() {
this.initElementConfig('s7-collapse');
},
onElementUpdate(element) {
this.emitChanges(element);
},
},
});
I'm trying to add an wysiwyg field with the sw-text-edtior component for my cms-element as an config field, but it doesn't show up at all. If I try an sw-text-field instead of an sw-text-editor component it does show up. I can't seem to find it in the docs if I am missing something.
My code:
config/sw-cms-el-config-collapse.html.twig
{% block sw_cms_element_collapse_config %}
<sw-text-editor
v-model="blockContent"
:allow-inline-data-mapping="true"
sanitize-input
@element-update="onElementUpdate">
</sw-text-field>
{% endblock %}
config/index.js
import template from './sw-cms-el-config-collapse.html.twig';
Shopware.Component.register('sw-cms-el-config-collapse', {
template,
mixins: ['cms-element'],
computed: {
blockContent: {
get() {
return this.element.config.blockContent.value;
},
set(value) {
this.element.config.blockContent.value = value;
},
},
},
created() {
this.createdComponent();
},
methods: {
createdComponent() {
this.initElementConfig('s7-collapse');
},
onElementUpdate(element) {
this.emitChanges(element);
},
},
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改此信息:
对此:
您使用“ SW-Text-editor”的开放标签,但您可以使用“ SW-Text-Field”关闭。
或者您查看基本组件:
https://github.com/shopware/shopware/blob/ab564a66dbaa112dfa20099881a718a80813c482/src/Administration/Resources/app/administration/src/module/sw-cms/ elements/text/component/sw-cms-el-text.html.twig#l10
在这里:
Change this:
to this:
you use the open tag of "sw-text-editor" but you close with "sw-text-field".
Or you look at the base components:
https://github.com/shopware/shopware/blob/ab564a66dbaa112dfa20099881a718a80813c482/src/Administration/Resources/app/administration/src/module/sw-cms/elements/text/component/sw-cms-el-text.html.twig#L10
Here: