When rendering a select
with a value
set, the select does not automatically select the item passed in as value:
function Form() {
const data = reactive({
current: "6",
items: [
{ label: "Item 5", value: "5" },
{ label: "Item 6", value: "6" },
{ label: "Item 7", value: "7" },
],
});
return list(
select({
oninput: (e) => (data.current = e.target.value),
value: () => data.current,
}),
data.items,
(i) => t.option({ value: i.val.value }, i.val.label),
)
}
To get the items to select, you have to pass selected: data.current === i.val.value
in your option
.
Is this expected behavior?