- Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Hello.
It works a little unusual (relative to the standard vue logic).
I implemented the radio buttons as follows. Please leave it here or take it out in the readme.
in template:
<check-box :ref="`checbox_${item.ID}`" :checked="localValue[itemIdx].checked" :text='item.VALUE' @checkedChange='localValue[itemIdx].checked = $event.value; onItemTap(item, itemIdx);' :boxType="multiple?'square':'circle'" />
event handler onItemTap:
onItemTap(item, itemIdx){ if (this.stopEvents) return; this.stopEvents=true; if (!this.multiple){ for(const idx in this.localValue){ if(this.localValue[idx].checked&&idx!=itemIdx){ this.$set(this.localValue[idx], 'checked', false); this.$refs[`checbox_${this.localValue[idx].ID}`].nativeView.checked=false } } } this.stopEvents=false; }
I use stopEvents so that removing unnecessary elements does not trigger the checkedChange event.
If there is a more concise solution, I will be glad to help.
Metadata
Metadata
Assignees
Labels
No labels