默认情况下,所有组件和部分布局都可供站点开发人员使用。有时,您可能希望隐藏某个组件或部分布局,以便在使用特定布局时该组件或部分布局不可用。例如,如果您希望提升不使用任何按钮组件或滑块部分布局的一致外观,则可以通过编辑主题的 components.json 文件来在主题中隐藏这些组件或布局。
要隐藏主题中的组件和部分布局,请执行以下操作:
hidden
设置为等于 true
。
"type":"scs-button", "id":"scs-button", "hidden":true
"type":"scs-sectionlayout", "id":"scs-sl-slider", "hidden":true
components.json 文件中用来隐藏按钮组件和滑块部分布局的完整条目如下所示:
[ { "name":"", "list":[ { "type":"scs-button", "id":"scs-button", "hidden":true }, { "type":"scs-sectionlayout", "id":"scs-sl-slider", "hidden":true } ] }, { "name": "Starter", "list": [ { "type": "component", "id": "StarterComponent", "themed": true }, { "type": "component", "id": "StarterFooter", "themed": true } ] } ]