mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-25 01:41:40 +00:00
added vuex to range slider
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div id="Threshold">
|
||||
<chrange class="spacing" title="Hue" :parentData="$store.getters.hue" @input="onChange('hue',$event)"></chrange>
|
||||
<chrange class="spacing" title="Saturation" :parentData="$store.getters.saturation" @input="onChange('saturation',$event)"></chrange>
|
||||
<chrange class="spacing" title="Value" :parentData="$store.getters.value" @input="onChange('value',$event)"></chrange>
|
||||
<chrange class="spacing" title="Hue" Xkey="hue"></chrange>
|
||||
<chrange class="spacing" title="Saturation" Xkey="saturation"></chrange>
|
||||
<chrange class="spacing" title="Value" Xkey="value"></chrange>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -20,9 +20,6 @@ import chselect from './ch-select.vue'
|
||||
chselect
|
||||
},
|
||||
methods:{
|
||||
onChange: function(key,event) {
|
||||
this.$store.commit(key, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,20 +19,28 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'ch-range',
|
||||
props:['title','parentData'],
|
||||
props:{title:'',
|
||||
Xkey:''
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
value:0
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user