代码是这样的
<div v-for="(item,index) in checkedData" :key="index">
<div style="background: #fff;margin-top: 5px;">
<h6>第{{index+1}}次下肢伤痛详细信息:</h6>
{{item}}
<van-field v-model="item.dates" is-link readonly :name="'datetimePicker_'+index" label="伤痛发生时间" class="lower" placeholder="请选择" @click="btns(index)" />
<van-popup v-model:show="showPicker" position="bottom">
<van-datetime-picker v-model="currentDate" type="date" :default-index="50" :formatter="formatter" :min-date="minDate" :max-date="maxDate" @confirm="onConfirm" @cancel="showPicker = false" />
</van-popup>
</div>
<van-field :name="'lateral_CB_'+index" label="下肢伤痛侧别" class="lo100">
<template #input>
<van-radio-group v-model="item.date" direction="horizontal">
<van-radio :name="'left_'+index">左</van-radio>
<van-radio :name="'right_'+index">右</van-radio>
</van-radio-group>
</template>
</van-field>
</div>
const update = (value: any) => {
listData.values = value;
if (value == "") {
listData.checkedData = [];
}
for (let i = 0; i < value; i++) {
// @ts-ignore
// ["date" + i]: ""
listData.checkedData.push({ date: "", dates: "" });
}
};
/* 弹窗 */
const showPQX = ref(false);
const onConfirm = (value: any) => {
console.log(timeFormat(value))
// timeFormat(value);
showPicker.value = false;
};
const onConfirmQX = (value: any) => {
listData.result_QX = value;
showPQX.value = false;
};
const timeFormat = (time: any) => {
let year = time.getFullYear();
let month = time.getMonth() + 1;
let day = time.getDate();
// + day + '日'
return year + "/" + month + "/" + day + "";
};
这里是根据用户输入的数量去生成表单,这样的级联框怎么去获取每个v-model
怎样将这个弹出框绑定对应的v-model的值?就是想达到和单选按钮一样的效果,现在就是点击弹出层的确认按钮后两个都发生一样的变化