1 回答

TA貢獻1840條經驗 獲得超5個贊
不是真正的答案,但上面的代碼是在 js fiddle 中找到并按預期工作
https://jsfiddle.net/andrewp37/a4obkhd5/1/
代碼:
<div id="app">
<label for="formSection">Section*</label>
{{ formModel }}
<select
v-model="formModel.idSection1"
class="form-control"
id="formSection"
name="formSection"
@change="onChangeSectionLevel1">
<option v-for="sectionLevel1 in formModel.sectionLevel1"
v-bind:value="sectionLevel1.value"
v-bind:key="sectionLevel1.id">
{{ sectionLevel1.value }}
</option>
</select>
</div>
new Vue({
el: "#app",
data: {
formModel: {
idSection1: null,
sectionLevel1: [
{
id: 1,
value: "Section 1"
}
]
}
},
methods: {
onChangeSectionLevel1() {
alert("changed");
}
}
})
我注意到添加了很多斷點后,模型會在頁面安裝后被替換。
添加回答
舉報