Lighting_data.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view>
  3. <view class="year-month">
  4. <button @click="month" class="month">最近一月</button>
  5. <button @click="year" class="year">最近一年</button>
  6. </view>
  7. <view class="chart">
  8. <month v-show="monthDate"></month>
  9. <year v-show="yearDate"></year>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. Screen: '',
  18. monthDate: true,
  19. yearDate: false,
  20. }
  21. },
  22. methods: {
  23. month() {
  24. this.monthDate = true
  25. this.yearDate = false
  26. },
  27. year(){
  28. this.monthDate = false
  29. this.yearDate = true
  30. }
  31. }
  32. }
  33. </script>
  34. <style lang="scss">
  35. .year-month {
  36. width: 100vmax;
  37. height: 10vmin;
  38. position: relative;
  39. margin-top: 3vmin;
  40. button {
  41. position: absolute;
  42. width: 15vmax;
  43. height: 10vmin;
  44. font-size: calc(30vmin / 7.5);
  45. display: flex;
  46. justify-content: center;
  47. align-items: center;
  48. background-color: cornflowerblue;
  49. color: #ffffff;
  50. &:active{
  51. transfORM: scale(0.98);
  52. box-shadow: 3px 2px 22px 1px rgba(0, 0, 0, 0.24);
  53. }
  54. }
  55. }
  56. .year {
  57. left: 30vmax;
  58. }
  59. .month {
  60. left: 5vmax;
  61. }
  62. .chart{
  63. width: 90vmax;
  64. height: 70vmin;
  65. }
  66. </style>