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.

67 lines
1.4 KiB

  1. <template>
  2. <view class="main">
  3. <view :style="{height:iSMT+'px'}"></view>
  4. <view class="top">
  5. <view class="top-list">
  6. <text>标准</text>
  7. <radio value="0" class="radio-btn" activeBackgroundColor="red"
  8. :checked="selectedIndex === 0" @click="selectFont(0)" />
  9. </view>
  10. <view class="top-list">
  11. <text>中号</text>
  12. <radio value="1" class="radio-btn" activeBackgroundColor="red"
  13. :checked="selectedIndex === 1" @click="selectFont(1)" />
  14. </view>
  15. <view class="top-list">
  16. <text>大号</text>
  17. <radio value="2" class="radio-btn" activeBackgroundColor="red"
  18. :checked="selectedIndex === 2" @click="selectFont(2)" />
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script setup>
  24. import {
  25. ref,
  26. onMounted
  27. } from 'vue'
  28. const iSMT = ref(0)
  29. const selectedIndex = ref(0)
  30. const selectFont = (index) => {
  31. selectedIndex.value = index
  32. console.log('看看选中状态',selectedIndex.value)
  33. }
  34. onMounted(() => {
  35. // 状态栏高度
  36. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  37. console.log('看看高度', iSMT.value)
  38. })
  39. </script>
  40. <style>
  41. .top {
  42. margin-top: 1.5vh;
  43. height: 21vh;
  44. background-color: white;
  45. }
  46. .top-list {
  47. width: 630rpx;
  48. height: 7vh;
  49. display: flex;
  50. align-items: center;
  51. margin: 0 40rpx;
  52. padding:0 10rpx;
  53. border-bottom: 1rpx solid #eee;
  54. }
  55. .top-list:last-child {
  56. border-bottom: none;
  57. }
  58. .radio-btn {
  59. margin-left: auto;
  60. transform: scale(0.6);
  61. }
  62. </style>