vue attr取不到属性值问题
js:$(document).ready(function() {$.get("/account/authGroupInfo",{id:groupId}, function(data) {var arr = data.data.rules.split(",");console.log(arr);$.get("/account/al
·
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
更多推荐
已为社区贡献3条内容
所有评论(0)