1.给需要获取value值的单选框设置同一个点击事件
在方法里传入event当前事件对象
<template>
<div>
<label><input @click="getRadioVal" type="radio" name="type" value="全部">全部</label>
<label><input @click="getRadioVal" type="radio" name="type" value="部分">部分</label>
<label><input @click="getRadioVal" type="radio" name="type" value="零散">零散</label>
</div>
</template>
<script>
export default {
methods:{
getRadioVal(event){ //event当前事件对象
var radioVal = event.target.value;
console.log(radioVal)
}
}
}
</script>
2.点击每一项获得当前项的value值