0

我想要按钮组件或input-type=button插件系统配置页面。

有谁知道如何添加它config.xml

我浏览了Shopware Core System Config Schema的主文件-

type没有任何按钮相关的东西。

<xs:simpleType name="type">
        <xs:restriction base="xs:string">
            <xs:enumeration value="text"/>
            <xs:enumeration value="textarea"/>
            <xs:enumeration value="url"/>
            <xs:enumeration value="password"/>
            <xs:enumeration value="int"/>
            <xs:enumeration value="float"/>
            <xs:enumeration value="bool"/>
            <xs:enumeration value="checkbox"/>
            <xs:enumeration value="datetime"/>
            <xs:enumeration value="date"/>
            <xs:enumeration value="time"/>
            <xs:enumeration value="colorpicker"/>
            <xs:enumeration value="single-select"/>
            <xs:enumeration value="multi-select"/>
        </xs:restriction>
    </xs:simpleType>
4

1 回答 1

1

简短的回答:你不能。

长答案:您可以通过 config.xml 中的组件类型生成任何 vue-js 组件

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/platform/master/src/Core/System/SystemConfig/Schema/config.xsd">
    <card>
        <title>#Test# Settings</title>

        <component name="sw-button">
            <name>button</name>
            <variant>primary</variant>
        </component>
    </card>
</config>

除了 name 之外,您分配的每个选项都作为 prop 传递给组件。然而,sw 按钮的问题在于,文本是通过默认插槽给出的,该插槽不能作为道具传递。所以不幸的是你不能通过 config.xml 创建按钮

但这确实没有任何意义,因为没有任何 vue-js 就无法控制需要发生的动作。最简单的事情是创建自己的 vue-js 模块。

于 2020-09-21T12:07:48.190 回答