Files
PhotonVision/chameleon-client/src/components/ch-range.vue

60 lines
1.6 KiB
Vue
Raw Normal View History

2019-03-24 21:01:25 +03:00
<template>
<row type="flex" justify="start" align="middle" :gutter="1">
<Col span="4">
<h4>{{title.charAt(0).toUpperCase() + title.slice(1)}} :</h4>
</Col>
<Col span="4" style="text-align: left">
2019-07-17 22:05:31 -07:00
<InputNumber style="align-self: flex-start;" v-model="value[0]" size="small" :step="steps" ></InputNumber>
</Col>
<Col span="10">
2019-07-19 01:40:06 -07:00
<Slider range v-model="value" @on-input="handleInput" :step="steps" :max="maximum"></Slider>
</Col>
<Col span="4" style="text-align: right">
2019-07-19 01:40:06 -07:00
<InputNumber style="align-self: flex-end;" v-model="value[1]" size="small" :step="steps" :max="maximum"></InputNumber>
</Col>
2019-03-24 21:01:25 +03:00
</row>
</template>
<script>
export default {
2019-03-26 22:28:58 +02:00
name: 'ch-range',
2019-03-29 18:20:40 +03:00
props:{
title:String,
2019-07-17 22:05:31 -07:00
Xkey:String,
2019-07-19 01:40:06 -07:00
steps:Number,
maximum:Number
2019-03-27 23:23:01 +02:00
},
2019-03-24 21:01:25 +03:00
data() {
return {
}
},
methods: {
handleInput() {
2019-03-27 23:23:01 +02:00
this.$socket.sendObj({[this.Xkey]:this.value});
2019-03-24 21:01:25 +03:00
}
2019-03-26 22:28:58 +02:00
},
2019-03-27 23:23:01 +02:00
computed:{
value:{
get:function(){
return this.$store.state[this.Xkey];
},
set:function(value){
this.$store.commit(this.Xkey,value);
}
}
2019-03-24 21:01:25 +03:00
}
}
</script>
<style>
2019-03-24 21:01:25 +03:00
h4 {
color: #e6ebf1;
}
/* .ivu-input-number-input{
background-color: #2c3e50 !important;
color: #fff !important;
} */
</style>