依照預設,建置網站的人員可在元件的設定值對話方塊中,指定大多數元件的對齊方式、寬度以及間距選項。不過,開發人員可能會將自訂元件的這些選項隱藏起來,讓提供者無法以與網站主題不一致的形式呈現內容。例如,若想要將按鈕置中並將間距設為 30 像素,以提昇成一致的外觀與感覺,您可以編輯主題的 components.json 檔案,隱藏設定值中變更這兩個樣式的選項。
若您想要覆寫自訂元件的最初預設值,也可以編輯 components.json 檔案。對最初值的所有變更只會套用至編輯過的 components.json 檔案上傳為新版本之後新增至頁面的元件。
隱藏主題中元件的對齊方式、寬度或間距設定值選項:
true
。
"type":"scs-button", "id":"scs-button", "hideAlignmentAndWidth": true, "hideSpacing": true,
"initialData": { "alignment": "center", "marginTop": 30, "marginBottom": 30
components.json 檔案中指定主題內按鈕元件之設定值對話方塊中預設值及隱藏對齊方式、寬度與間距選項的完整項目如下:
[ { "name": "", "list": [ { "type": "scs-button", "id": "scs-button", "hideAlignmentAndWidth": true, "hideSpacing": true, "initialData": { "alignment": "center", "marginTop": 30, "marginBottom": 30 } } ] }, { "name": "Starter", "list": [ { "type": "component", "id": "StarterComponent", "themed": true }, { "type": "component", "id": "StarterFooter", "themed": true } ] } ]