js:
$(document).ready(function() { $.get("/account/authGroupInfo",{id:groupId}, function(data) { var arr = data.data.rules.split(","); console.log(arr); $.get("/account/allRule",{}, function(result) { ruleList.options = result.data;//問題所在 ruleList.$nextTick(function () { $(".auth_rules").each(function () { if($.inArray($(this).attr("id"),arr)>-1) { $(this).prop('checked',true); } }) }) }); });});html:
<tr v-for="value in options"> <td><input type="checkbox" id="{{value.id}}" value="{{value.id}}," class="auth_rules">{{ value.title }}</td></tr>使用
ruleList.$nextTick(function () {}) 拿到更新后的dom
以上這篇解決vue attr取不到屬性值的問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。
新聞熱點(diǎn)
疑難解答