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

Vue 3 support #60

Open
amchconsult opened this issue Oct 29, 2022 · 3 comments
Open

Vue 3 support #60

amchconsult opened this issue Oct 29, 2022 · 3 comments

Comments

@amchconsult
Copy link

Are you planning to do a vue 3 version?
thank you

@amchconsult
Copy link
Author

Also question, Why is it returning the object and not only the value from option-key? like a regular select
is it a way to do that?
is it anything like @change where i can catch the change and do something after?
thank you

@Pachara
Copy link

Pachara commented Sep 23, 2023

I think we are facing same issue

@Pachara
Copy link

Pachara commented Sep 23, 2023

This is my temporary solutions

First
Wrap vue-single-select with DIV
.

<div class="col-6 p-0" @click="changeLocation()">
                     <strong>จังหวัด</strong>
                     <vue-single-select id="single_selected" name="single_selected" 
                     v-model="selectedLocation" :options="locations"  :value="false" option-label="name" placeholder="กรุงเทพมหานคร" :max-results="300" class="peter-web" ></vue-single-select>
                 </div>

Second
Create custom function
.

changeLocation(){
               let dom = document.getElementsByName('single_selected');
               if(dom.length == 1){
                    this.selectedLocation = this.locations.find(item => item.name === dom[0].value)
               }else{
                    this.selectedLocation = this.locations.find(item => item.id === 1)
               }
          },

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

2 participants