test
3 months ago
1 changed files with 40 additions and 0 deletions
@ -0,0 +1,40 @@ |
|||
<template> |
|||
<view class="flex uni-row"> |
|||
<view class="" > |
|||
<u-checkbox size="50" v-model="checkAll" @change="checkAllItems" > |
|||
</u-checkbox> |
|||
</view> |
|||
<view> |
|||
<text style="margin-left: 10rpx; font-size: 35rpx;font-weight: bold;">全选({{checkCount}}/{{allCount}})</text> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import {nextTick, ref} from 'vue' |
|||
const props = defineProps({ |
|||
checkCount: { |
|||
type: Number, |
|||
default: 0 |
|||
}, |
|||
allCount: { |
|||
type: Number, |
|||
default: 0 |
|||
}, |
|||
}) |
|||
const emit = defineEmits(['checkAllItems']) |
|||
const checkAll = ref(false) |
|||
|
|||
const checkAllItems = ()=>{ |
|||
checkAll.value = !checkAll.value |
|||
emit('checkAllItems', checkAll.value) |
|||
} |
|||
const changeCheckAllState = ()=>{ |
|||
nextTick(()=>{ |
|||
checkAll.value = props.checkCount == props.allCount |
|||
}) |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
Loading…
Reference in new issue