deviceDetail.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view class="device-detail-box">
  3. <aircondition v-if="type === 'aircondition'" :title="title"></aircondition>
  4. <lighting v-else-if="type === 'lighting'" :title="title" :space="space"></lighting>
  5. <meter-show v-else-if="type === 'meter'" :title="title" :space="space"></meter-show>
  6. <water v-else-if="type === 'water'" :title="title" :space="space"></water>
  7. <environment v-else-if="type === 'environment'"></environment>
  8. <control v-else-if="type === 'control'" :title="title"></control>
  9. </view>
  10. </template>
  11. <script>
  12. import aircondition from '@/components/device/aircondition';
  13. import lighting from '@/components/device/lighting';
  14. import meterShow from '@/components/device/meter';
  15. import water from '@/components/device/water';
  16. import environment from '@/components/device/environment';
  17. import control from '@/components/device/control'
  18. export default {
  19. data() {
  20. return {
  21. type: '',
  22. title: '',
  23. space: ''
  24. }
  25. },
  26. onLoad(body) {
  27. this.title = body.name;
  28. this.space = body.space || '';
  29. uni.setNavigationBarTitle({
  30. title: body.name
  31. });
  32. this.type = body.type
  33. },
  34. onPageScroll(e) {
  35. // 获取页面滚动的垂直距离
  36. uni.$emit('onPageScroll', e.scrollTop);
  37. },
  38. methods: {
  39. },
  40. components: {
  41. aircondition,
  42. lighting,
  43. meterShow,
  44. water,
  45. environment,
  46. control
  47. },
  48. }
  49. </script>
  50. <style>
  51. </style>