[Vuejs]-Get value from ion-select and store it in localstorage

0👍

You can get the selected value from the detail property of the CustomEvent emitted:

Note that I removed the (options) from the event handler.

Template:

 <ion-select
  @ionChange="store"
  v-model="options"
  placeholder="Kies status"
 >

Method:

methods: {
  store(event) {
    const name = event.detail.value;
    console.log("name" + name);
    const selected = localStorage.setItem("option", name);
},

BTW localStorage.setItem() always returns undefined so it doesn’t make sense to save it to a variable (in your case selected.

Leave a comment