BatteryState.vue 639 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <view>
  3. <image :src="getchargeState"></image>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. props: ["batteryState"],
  9. data() {
  10. return {
  11. }
  12. },
  13. computed: {
  14. getchargeState() {
  15. switch (this.batteryState) {
  16. case 0:
  17. return '/static/index/battery-null.png'
  18. case 1:
  19. return '/static/index/battery-has.png'
  20. case 2:
  21. return '/static/index/battery-warn.png'
  22. default:
  23. return '/static/index/battery-null.png'
  24. }
  25. }
  26. },
  27. methods: {
  28. }
  29. }
  30. </script>
  31. <style lang="scss" scoped>
  32. image {
  33. width: 70px;
  34. height: 70px;
  35. }
  36. </style>