<template>
	<ch-flex class="question-item" justify="center" items="center">
		<checkbox ref="checkRef" :value="item.questionid.toString()" />
		<uni-card @click="checkQues(item.questionid)">
			<view class="question__sort-content">{{ item.questioncontent }}</view>
			<view class="question__info">
				<text>{{ item.gradename }}</text>
				<text>{{ item.addtime }}</text>
				<text>{{ item.subjectname }}</text>
			</view>
		</uni-card>
	</ch-flex>
</template>

<script setup>
import { defineProps, defineEmits, watch, ref, computed, onMounted } from 'vue';

const props = defineProps([
	'item'
]);

const emit = defineEmits(['clickItem', 'change'])

const checkValue = ref(null);
const checkStatus = ref(false);
const checkRef = ref(null)

onMounted(() => {
	console.log(checkRef)
}) 

watch(checkValue, (newValue) => {
	console.log('change')
	emit('change', newValue)
})

function checkQues(id) {
	emit('clickItem', id)
}
</script>

<style scoped lang="scss">
$lineHeight: $uni-font-size-base * 1.5;

.question__sort-content {
	font-size: $uni-font-size-base;
	line-height: $lineHeight;
	height: $lineHeight;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-bottom: 16rpx;
}

.question__info {
	> text {
		font-size: $uni-font-size-mini;
		color: $uni-secondary-color;
		+ text {
			margin-left: 16rpx;
		}
	}
}
</style>