<template>
  <view class="control">
	<txt v-if="controlType(item)=='txt'" :item="item" @showChart="showChart"></txt>
	<ctl v-if="controlType(item)=='ctl'" :item="item" :device="device" @mqttPublish="mqttPublish" @showChart="showChart"></ctl>
	<octl v-if="controlType(item)=='octl'" :item="item" :device="device" @mqttPublish="mqttPublish" @showChart="showChart"></octl>
	<aoctl v-if="controlType(item)=='aoctl'" :item="item" :device="device" @mqttPublish="mqttPublish" @showChart="showChart"></aoctl>
	<actl v-if="controlType(item)=='actl'" :item="item" :device="device" @mqttPublish="mqttPublish" @showChart="showChart"></actl>
  </view>
</template>

<script>
import {controlType} from './util.js'
import txt from './txt.vue'
import ctl from './ctl.vue' 
import octl from './octl.vue'
import aoctl from './aoctl.vue'
import actl from './actl.vue'
export default { 
  name: 'index',
  mixins: [],
 components:{txt,ctl,octl,aoctl,actl},
  props: {
	  item:Object,
	  device:Object
  },
  data() {
    return{}
  },
  computed: {
      
  },
  watch: {},
  created() {},
  mounted() {},
  destroyed() {},
  methods: {
	  controlType(item){
	  	return controlType(item)
	  },
	  showChart(item){
		  this.$emit('showChart',item);
	  },
	  mqttPublish(item){
	  	this.$emit('mqttPublish',item);
	  		  
	  }
  },
};
</script>
<style lang="scss" scoped>
</style>