mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
44 lines
1.0 KiB
Vue
44 lines
1.0 KiB
Vue
<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">
|
|
<i-switch v-model="value" @on-change="handleInput" style="align-self: flex-start"></i-switch>
|
|
</Col>
|
|
</Row>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'ch-switch',
|
|
props:{
|
|
title: String,
|
|
Xkey: String
|
|
},
|
|
methods:{
|
|
handleInput() {
|
|
this.$socket.sendObj({[this.Xkey]:this.value});
|
|
}
|
|
},
|
|
computed:{
|
|
value:{
|
|
get: function(){
|
|
return this.$store.state[this.Xkey];
|
|
},
|
|
set: function(value){
|
|
this.$store.commit(this.Xkey,value);
|
|
}
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="" scoped>
|
|
|
|
</style> |