废话不多说直接上代码:
<template>
<div class="flex">
<div class="flex" v-for="(item,index) in radio" :key="index" @click="heightliang(index)">
<div class="radio">
<span :class="{radiosmall:index==isactive}"></span>
</div>
<p>{{item}}</p>
</div>
</div>
</template>
<style scoped>
.flex{
display: flex;
align-items: center;
}
.radio{
width: 8px;
height: 8px;
border-radius:50%;
border:1px solid #ffa126;
display: flex;
justify-content: center;
align-items: center;
}
.radiosmall{
width: 6px;
height: 6px;
background-color: #ffa126;
border-radius: 50%;
}
</style>
<script>
export default {
data() {
return {
radio:["你好","hello","私密马赛"],
isactive:0
}
},
methods:{
heightliang(e){
this.isactive = e
}
}
}
</script>