mirror of
https://github.com/speatzle/nfsense.git
synced 2025-07-17 06:59:09 +00:00
Nice form (#11)
* wip * vee-validate experiments * get test enabled form working * Make PillBar Properly work with ModelValue * Register NumberBox Globally * Rework NiceForm * Use new form props * Rework Definitions for new Form
This commit is contained in:
parent
2fb089ba73
commit
4c78d1da66
7 changed files with 153 additions and 74 deletions
|
@ -10,25 +10,17 @@ const props = defineModel<{
|
|||
}>();
|
||||
let { options, modelValue } = $(props);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'selectionChanged'): void
|
||||
}>();
|
||||
|
||||
function select(option: any, index: number) {
|
||||
for(let opt of options) {
|
||||
opt.selected = false;
|
||||
onMounted(async() => {
|
||||
if (modelValue === undefined) {
|
||||
modelValue = 0
|
||||
}
|
||||
option.selected = true;
|
||||
modelValue = index;
|
||||
emit('selectionChanged');
|
||||
console.debug("selected", options);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<button class="option" v-for="(option, index) in options" :key="index" :class="{selected:option.selected}" @click="select(option, index)">
|
||||
<button class="option" v-for="(option, index) in options" :key="index" :class="{selected: modelValue == index}" @click="modelValue = index">
|
||||
<i class="material-icons" v-if="option.icon">{{ option.icon }}</i>
|
||||
{{ option.name }}
|
||||
</button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue