解决vue attr取不到属性值的问题
时间:2021-02-17 14:01:59|栏目:vue|点击: 次
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
上一篇:vuejs通过filterBy、orderBy实现搜索筛选、降序排序数据
栏 目:vue
本文标题:解决vue attr取不到属性值的问题
本文地址:http://www.codeinn.net/misctech/64480.html






