index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="component-wrapper u000242" :style="wrapper_style">
  3. <view class="weather_left">
  4. <view class="weather_left_top" :style="weather_style">
  5. <view style="fontSize:20px ;">38℃</view>
  6. <view>多云</view>
  7. <view>2018-08-20</view>
  8. <view>星期一</view>
  9. </view>
  10. <view class="weather_left_bottom">
  11. <view>
  12. 温度变化:{{ '27°-37°'}}
  13. </view>
  14. <view>
  15. 空气质量: {{'轻度污染'}}
  16. </view>
  17. <view>
  18. 风力: {{'二级'}}
  19. </view>
  20. </view>
  21. </view>
  22. <u-icon :style="img_style" name="eye" :color="datas.text_color" size="28"></u-icon>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: ['styles', 'datas'],
  28. computed: {
  29. /** 样式 */
  30. wrapper_style() {
  31. const {
  32. bg_color,
  33. padding_top,
  34. padding_bottom,
  35. padding_left,
  36. padding_right,
  37. } = this.datas;
  38. return `
  39. min-height: 40px;
  40. padding: ${padding_top}px ${padding_right}px ${padding_bottom}px ${padding_left}px;
  41. background-color: ${bg_color};
  42. background-size: 100% auto;
  43. bakcground-position: center;
  44. `;
  45. },
  46. /** 标题样式 */
  47. title_style() {
  48. const {
  49. text_align,
  50. text_size,
  51. text_color
  52. } = this.datas;
  53. return `
  54. margin-left: 10px;
  55. text-align: ${text_align};
  56. font-size: ${text_size}px;
  57. color: ${text_color};
  58. `;
  59. },
  60. //文字颜色
  61. weather_style() {
  62. const { text_color } = this.datas
  63. return `
  64. color:${text_color};
  65. `;
  66. },
  67. img_style() {
  68. const { text_color } = this.datas
  69. return `
  70. color:${text_color};
  71. font-size:35px;
  72. margin-left:15px;
  73. margin-top:-5px;
  74. `;
  75. },
  76. /** 标题 */
  77. title() {
  78. return '公告内容';
  79. },
  80. },
  81. mounted() {
  82. this.$emit('loaded');
  83. }
  84. };
  85. </script>
  86. <style lang="less" scoped>
  87. .component-wrapper {
  88. display: block;
  89. max-width: 100%;
  90. // text-align: center;
  91. margin-left: auto;
  92. margin-right: auto;
  93. overflow: hidden;
  94. text-decoration: none;
  95. display: flex;
  96. align-items: center;
  97. .weather_left {
  98. width: 85%;
  99. .weather_left_top {
  100. color: #FCBD56;
  101. display: flex;
  102. align-items: flex-end;
  103. justify-content: space-between;
  104. width: 85%;
  105. margin-bottom: 8px;
  106. }
  107. .weather_left_bottom {
  108. width: 90%;
  109. font-size: 10px;
  110. width: 100%;
  111. display: flex;
  112. align-items: flex-end;
  113. justify-content: space-between;
  114. }
  115. }
  116. }
  117. .img {
  118. width: 25px;
  119. height: 25px;
  120. margin: 10px;
  121. }
  122. </style>