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.
|
|
<template> <view class="main"> <view :style="{height:iSMT+'px'}"></view> <view class="top"> <view class="top-list"> <text>标准</text> <radio value="0" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 0" @click="selectFont(0)" /> </view> <view class="top-list"> <text>中号</text> <radio value="1" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 1" @click="selectFont(1)" /> </view> <view class="top-list"> <text>大号</text> <radio value="2" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 2" @click="selectFont(2)" /> </view> </view> </view></template>
<script setup> import { ref, onMounted } from 'vue' const iSMT = ref(0) const selectedIndex = ref(0)
const selectFont = (index) => { selectedIndex.value = index console.log('看看选中状态',selectedIndex.value) } onMounted(() => { // 状态栏高度
iSMT.value = uni.getSystemInfoSync().statusBarHeight; console.log('看看高度', iSMT.value) })</script>
<style> .top { margin-top: 1.5vh; height: 21vh; background-color: white; }
.top-list { width: 630rpx; height: 7vh; display: flex; align-items: center; margin: 0 40rpx; padding:0 10rpx; border-bottom: 1rpx solid #eee; }
.top-list:last-child { border-bottom: none; }
.radio-btn { margin-left: auto; transform: scale(0.6); }</style>
|