vuex realtime value redone

This commit is contained in:
ori agranat
2019-03-27 23:12:15 +02:00
parent 1d95afc0f7
commit 9a2232974a
5 changed files with 42 additions and 26 deletions

View File

@@ -14,24 +14,30 @@
<script>
export default {
name: 'ch-select',
props:[
'title',
'list',
'parentData'
],
props:{
title:'',
list:[],
Xkey:''
},
data() {
return {
content:this.value
value
}
},
methods: {
handleInput() {
this.$emit('input',this.value);
this.$socket.sendObj({[this.title]:this.value});
this.$socket.sendObj({[this.Xkey]:this.value});
}
},
beforeMount () {
this.value = this.parentData
computed:{
value:{
get: function(){
return this.$store.state[this.Xkey];
},
set: function(value){
this.$store.commit(this.Xkey,value);
}
}
}
}
</script>