[Vuejs]-Computed properties in vue not reflected in select list

0๐Ÿ‘

โœ…

I think a better approach would be to already filter the data inside of your computed function as follows:

computed: {
    destinationFields: function() {
        return this.$store.getters.visibleDestination()
            .filter(dest => !dest.hasOwnProperty('mapped') || dest.id === this.destination)
    },
    hideDestination: function() {
        return this.$store.getters.hideMappedDestinations // boolean 
    }
}

You would also have to change your template to:

<select v-model="destination" class="form-control form-control-sm">
    <option v-for="dest in destinationFields" v-bind:value="dest.id">{{ dest.id }} - {{ dest.label }} ({{ dest.dataType }})</option>
</select>
๐Ÿ‘คuser4345609

Leave a comment