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. }}</td>
</tr>
使用
ruleList.$nextTick(function () {}) 拿到更新后的dom
以上这篇解决vue attr取不到属性值的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
继续阅读与本文标签相同的文章
-
与你同行,才能无障碍
2026-05-18栏目: 教程
-
分布式Id - redis方式
2026-05-18栏目: 教程
-
HTML5 容器入门解析:支付宝 Hybrid 方案原理与实战
2026-05-18栏目: 教程
-
阿里云910会员节:开启时光机领会员大礼包,云产品满减优惠活动
2026-05-18栏目: 教程
-
基于宜搭的“报表分析”实践案例
2026-05-18栏目: 教程
