预期结果应返回id的值
-
//输出
<select class="form-control" name="uploaded_segment_id" id="uploaded_segment_id" required="">
<option value="">Choose Segment</option>
<option v-for="uploaded_segment in uploaded_segments" value="@{{ uploaded_segment.id }}"> @{{ uploaded_segment.name }}</option>
</select>
答案 0 :(得分:4)
根据documentation,这是做到这一点的方法:
<option v-for="option in options" v-bind:value="option.value">
{{ option.text }}
</option>
所以改变这一行:
<option v-for="uploaded_segment in uploaded_segments" value="@{{ uploaded_segment.id }}"> @{{ uploaded_segment.name }}</option>
到:
<option v-for="uploaded_segment in uploaded_segments" v-bind:value="uploaded_segment.id"> @{{ uploaded_segment.name }}</option>