文件
OmniCard/mpuniapp/pages/template/radio-200/radio-200.uvue

41 行
1.3 KiB
Plaintext

<template>
<view style="background-color: #f5f5f5;">
<!-- #ifndef MP -->
<fps />
<!-- #endif -->
<!-- 控制按钮区域 -->
<view style="padding: 2px;background-color: #ffffff;flex-direction: row;flex-wrap: wrap;align-items: center;">
<button @click="toggleDisabled" :type="sharedDisabled ? 'primary' : 'default'" size="mini" style="margin: 2px;">{{ sharedDisabled ? '启用' : '禁用' }}</button>
</view>
<!-- 200个radio组件 -->
<radio-group @change="onSharedChange" style="flex-direction: row;flex-wrap: wrap;padding: 2px;">
<radio
:value="index.toString()"
:checked="sharedChecked === index.toString()"
:disabled="sharedDisabled"
v-for="index in 200" :key="index"
/>
</radio-group>
</view>
</template>
<script setup lang="uts">
const sharedChecked = ref('')
const sharedDisabled = ref(false)
function toggleDisabled() {
sharedDisabled.value = !sharedDisabled.value
console.log('切换disabled状态:', sharedDisabled.value)
}
function onSharedChange(e : UniRadioGroupChangeEvent) {
sharedChecked.value = e.detail.value
console.log('radio状态改变:', e.detail.value)
}
</script>
<style>
</style>