Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More examples for vue #143

Open
SlavMAK opened this issue Jun 26, 2022 · 0 comments
Open

More examples for vue #143

SlavMAK opened this issue Jun 26, 2022 · 0 comments

Comments

@SlavMAK
Copy link

SlavMAK commented Jun 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant