horizontalDirection.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <scroll-view class="scroll" v-if="list.length" :scroll-x="true">
  3. <view class="box">
  4. <view class="item" v-for="item in list" :key="item.w_dataparamid">
  5. <view class="label">
  6. {{ item.paramname }}
  7. <text v-if="item.unit">
  8. ({{ item.unit }})
  9. </text>
  10. </view>
  11. <view class="value">
  12. {{ item.lastvalue }}
  13. </view>
  14. </view>
  15. </view>
  16. </scroll-view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {},
  21. name: "horizontalDirection",
  22. data() {
  23. return {
  24. list: []
  25. }
  26. },
  27. methods: {
  28. getList(w_deviceid) {
  29. return new Promise((resolve, reject) => {
  30. this.$Http.basic({
  31. "id": 20230711165702,
  32. "content": {
  33. w_deviceid
  34. }
  35. }).then(res => {
  36. console.log("设备实时数据查询", res)
  37. if (this.cutoff(res.msg)) return resolve(0)
  38. this.list = res.data;
  39. resolve(res.data.length ? 49 : 0)
  40. })
  41. })
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .scroll {
  48. width: 355px;
  49. background: #FFFFFF;
  50. border-radius: 4px;
  51. margin: 15px auto 0;
  52. height: 62px;
  53. .box {
  54. display: flex;
  55. flex-wrap: nowrap;
  56. align-items: center;
  57. padding: 12px;
  58. box-sizing: border-box;
  59. .item {
  60. flex-shrink: 0;
  61. padding-right: 15px;
  62. .label {
  63. line-height: 14px;
  64. font-size: 10px;
  65. color: #666666;
  66. }
  67. .value {
  68. margin-top: 5px;
  69. line-height: 20px;
  70. font-size: 14px;
  71. font-family: PingFang SC-Bold, PingFang SC;
  72. font-weight: bold;
  73. color: #333333;
  74. }
  75. }
  76. }
  77. }
  78. </style>