0
我想根據數據庫中特定數據的存在來選中我的複選框。我在laravel使用vuejs。 以下是我的複選框代碼:有條件的v-bind:簽入vuejs
<input type="checkbox" value="{{$complaint->complaintID}}" :checked="CheckCECDecisionSigned({{$complaint->complaintID}})" disabled>
而下面是我的vuejs方法:
methods: {
CheckCECDecisionSigned: function (complaintID) {
if (complaintID) {
var self = this;
this.$http.get('/cimsm/public/api/fetchCECDecisionSignature/' + complaintID).then(function (response) {
if (response.data.length > 0) {
return true;
}
});
}
},
正如你所看到的,如果response.data.length > 0
那麼我想返回true,因此有複選框選中。但我似乎無法得到返回布爾值的方法,即使response.data.length
大於0
你能幫我嗎?