javascript - How to use computed property with getters and setters to trigger commit in Vuex -


i using computed property: category in input field bound v-bind following:

  <select name="category" :value="category">     <option value="ac">ac</option>     <option value="tv">tv</option>     ...   </select> 

and have getters , setter computed property follows:

computed:{     category: {       () {         return this.$store.state.category       },       set (value) {         console.log("value of category changed")         this.store.commit("set_cat", value)       }     } } 

but when change input, setter not called, how can achived this, or other way can change state variable directly html input field.

here fiddle this.

this worked change v-bind v-model in select.

<select name="category" v-model="category">   <option value="" disabled hidden>select product</option>   .... 

here working fiddle.

please post answer if feel there still better way it.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -