I am somehow stuck right now. what I want to do seems rather basic. I want to filter an ion-list depending on some ion-select (v-model filterSize
) choices however I can’t get it to work. here is my code
<ion-select multiple="false" cancel-text="back" ok-text="ok" v-model="filterSize" @ionChange="onChange($event)">
<ion-select-option value="0">small</ion-select-option>
<ion-select-option value="1">middle</ion-select-option>
<ion-select-option value="2">big</ion-select-option>
</ion-select>
...
<ion-list>
<ion-item :key="animal.id" v-for="animal in animals">
<ion-label>
<h2>{{ animal.name_dt }}</h2>
</ion-label>
</ion-item>
</ion-list>
...
data() {
const { animals } = getAllAnimals();
const filterSize = [] as number[];
return {
filterSize, animals
}
}
methods: {
async onChange (e: Event) {
console.log(JSON.stringify(this.filterSize));
const {animals} = await getFilterAnimals(this.filterSize);
console.log(JSON.stringify(e));
this.$forceUpdate();
return animals;
}
}
however the v-model filterSize
seems to be empty and the list does never change therefore. is filterSize
wrongly declared? and how do I properly update the animals
ion-list then after the onChange is fired?
thank you very much if someone can give me a hint
EDIT: I read that Ionic Vue has a problem with binding the v-model
in an Ion-Select
. that would explain my troubles. is that still the case in the latest version and if yes is there a workaround?