HI大家好, 目前想實作vue.js select v-on:change 來篩選後端API的資料, 但發現資料都沒回來請問是哪邊有做錯呢?? 還煩請各位大大指點迷津 謝謝
data:{
selected_target: {}
}
, methods: {
, LoadData: function (data) {
var thisVue = this;
return $.ajax({
method: "POST"
, url: "@Url.Action("LoadDataList", "LodData")"
, data: {data_id: data.id}
, success: function (result, textStatus, jqXHR) {
if (result.code == "S") {
thisVue.selected_target = result.Data;
}
else {alertResultModel(result);}
}
, error: function (jqXHR, textStatus, errorThrown) {
alertError("error");
}
});
}
, SelectTarget: function (event) {
this.selected_target = event.target.value;
console.log(this.selected_target)
}
<select class="form-control"
v-model="selected_target"
v-on:change="SelectTarget($event)">
<option selected>請選擇...</option>
<option v-for="data in Data_List"
v-bind:value="data.id">
{{ data.name }}
</option>
</select>