<template>
<view class="container">
<my-question @click="onAnswer(index)" class="my_question" v-for="(item,index) in questions"
:key="item._id" :ctitle="item.c_title" :etitle="item.e_title" :isanswer="item.isAnswer"
:index="index+1"></my-question>
</view>
<my-footer v-show="questions.length>0"></my-footer>
</template>
<template>
<view class="question" @click="_onClick">
<view class="question_left">
<match-media :min-width="800">
<span class="question_index">{{index}} </span>
</match-media>
<view class="question_title">
<span class="e_title">{{etitle}}</span>
<span class="c_title">{{ctitle}}</span>
</view>
</view>
<span class="question_right">
<uni-icons v-if="isanswer" color="#00aa00" type="smallcircle-filled" size="18"></uni-icons>
<uni-icons v-else class="icon" type="circle" size="18"></uni-icons>
</span>
</view>
</template>
<script setup>
const emits = defineEmits(['click'])
defineProps({
index: {
type: Number,
default: 0
},
etitle: {
type: String,
default: '中文标题'
},
ctitle: {
type: String,
default: 'English Title'
},
isanswer: {
type: Boolean,
default: false
}
})
// 组件点击事件
const _onClick = (e) => {
// $emit('click',e)
emits('click')
}
</script>