@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 746 B
JavaScript
import*as Menus from"../../../../ui/components/menus/menus.js";const root=document.getElementById("root");function makeMenu(e){const t=[],n=new Menus.SelectMenu.SelectMenu,o=[{text:"A short option",value:"option-1"},{text:"A very long option that has a lot of text",value:"option-2"},{text:"An average sized option",value:"option-3"}];o.forEach((e=>{const o=new Menus.Menu.MenuItem;o.value=e.value,o.textContent=e.text,n.appendChild(o),t.push(o)})),n.addEventListener("selectmenuselected",(e=>{t.forEach((t=>{t.selected=t.value===e.itemValue}));const u=o.find((t=>t.value===e.itemValue));n.buttonTitle=u?.text||""})),t[1].selected=!0,n.buttonTitle=o[1].text,n.showArrow=!0,n.id=e,root?.appendChild(n)}makeMenu("width-150"),makeMenu("width-400");