deviceCard.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="box" @click="goDeviceInfo">
  3. <view class="topBox">
  4. <text>{{device.devName}}</text>
  5. <text>{{device.online ? '在线':'离线'}}</text>
  6. </view>
  7. <text>电量:{{device.Power}}%</text>
  8. <text class="iccid" space="ensp">uuid: {{device.uuid}}</text>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. props: {
  14. device:{
  15. type:Object,
  16. default:function(){
  17. return {
  18. name:'',
  19. ssid:''
  20. }
  21. }
  22. }
  23. },
  24. data: () => ({}),
  25. computed: {},
  26. methods: {
  27. goDeviceInfo() {
  28. console.log("goDeviceInfo");
  29. uni.navigateTo({
  30. url: "../../../pages/demo/mqtt/deviceInfo",
  31. complete(res){
  32. console.warn(res);
  33. }
  34. });
  35. },
  36. },
  37. watch: {},
  38. // 组件周期函数--监听组件挂载完毕
  39. mounted() {},
  40. // 组件周期函数--监听组件激活(显示)
  41. activated() {},
  42. // 组件周期函数--监听组件停用(隐藏)
  43. deactivated() {},
  44. // 组件周期函数--监听组件销毁之前
  45. beforeDestroy() {},
  46. };
  47. </script>
  48. <style>
  49. .box{
  50. display: flex;
  51. flex-direction:column;
  52. justify-content: space-between;
  53. width: 40vw;
  54. height: 25vw;
  55. border: 1rpx solid #333333;
  56. }
  57. .topBox{
  58. display: flex;
  59. flex-direction:row;
  60. justify-content: space-between;
  61. }
  62. .iccid{
  63. word-break: break-all;
  64. /* text-overflow:ellipsis;
  65. overflow: hidden;
  66. white-space: nowrap; */
  67. }
  68. </style>