按鈕
若要顯示按鈕,我們使用元件button。
JUI中的按鈕元件代表html <button/>
.
const buttonJSON = {
"component": "button",//tells the component name
"label": "Yes, login",//tells the text for the button
"variant": "cta",//tells the variants for the button which provides default styles
"on-click": "done",//tells what function to run after user clicks the button
};
這將會產生一個按鈕,其標籤為 Yes, login
. 其他屬性包括但不限於variant、label、on-click。
注意: 此
on-<events>
是叫用控制器中命令的語法。
轉譯的按鈕看起來像這樣:
recommendation-more-help
11125c99-e1a1-4369-b5d7-fb3098b9b178