文件
OmniCard/mpuniapp/pages/template/label-100/label-100.uvue

37 行
1.2 KiB
Plaintext

<template>
<view style="flex-direction: column;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="toggleAll" size="mini" style="margin: 2px;">{{ sharedChecked ? '取消' : '全选' }}</button>
</view>
<!-- 100个label+checkbox组合 -->
<checkbox-group style="flex-direction: row;flex-wrap: wrap;padding: 2px;" @change="onGroupChange">
<label v-for="index in 100" :key="index" style="width: 12%;margin: 4rpx;padding: 1px;align-items: center;flex-direction: column;">
<text style="font-size: 9px;color: #666;margin-bottom: 2px;">{{ index }}</text>
<checkbox :value="index.toString()" :checked="sharedChecked" />
</label>
</checkbox-group>
</view>
</template>
<script setup lang="uts">
const sharedChecked = ref(false)
function toggleAll() {
sharedChecked.value = !sharedChecked.value
console.log('切换全选状态:', sharedChecked.value)
}
function onGroupChange(e : UniCheckboxGroupChangeEvent) {
console.log('checkbox-group change:', e.detail.value)
}
</script>
<style>
</style>