You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.4 KiB

  1. <template>
  2. <view class="main">
  3. <view :style="{height:iSMT+'px'}"></view>
  4. <view class="theme">
  5. <view class="left">
  6. <image class="img-theme" src="/static/my/whiteTheme.png" mode="widthFix" />
  7. <radio value="0" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 0"
  8. @click="selectFont(0)" />
  9. </view>
  10. <view class="left">
  11. <image class="img-theme" src="/static/my/blackTheme.png" mode="widthFix" />
  12. <radio value="1" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 1"
  13. @click="selectFont(1)" />
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script setup>
  19. import {
  20. ref,
  21. onMounted
  22. } from 'vue'
  23. const iSMT = ref(0)
  24. const selectedIndex = ref(0)
  25. const selectFont = (index) => {
  26. selectedIndex.value = index
  27. console.log('看看选中状态', selectedIndex.value)
  28. }
  29. onMounted(() => {
  30. // 状态栏高度
  31. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  32. console.log('看看高度', iSMT.value)
  33. })
  34. </script>
  35. <style>
  36. .theme {
  37. margin-top: 1.5vh;
  38. height: 34vh;
  39. background-color: white;
  40. display: flex;
  41. justify-content: space-around;
  42. }
  43. .img-theme {
  44. width: 316rpx;
  45. height: 362rpx;
  46. }
  47. .left {
  48. width: 350rpx;
  49. display: flex;
  50. flex-direction: column;
  51. justify-content: center;
  52. align-items: center;
  53. }
  54. .radio-btn {
  55. margin-top: 36rpx;
  56. transform: scale(0.8);
  57. }
  58. </style>