@Tomoe 已解决。感谢。我写问题的时候忘记带上 { } 了 但是我实际代码上带了的。
初始化vue:
$.ajax({
url: '/test.html',
type: 'GET',
dataType: 'json',
data: {id: id},
})
.done(function(dataJson) {
console.log(dataJson);
var example1 = new Vue({
el: '#test',
data: dataJson
});
})
.fail(function() {
console.log("error");
})
HTML代码:
<div id="test">
<table class="table wp100">
<thead>
<tr>
<td>序号</td>
<td>名称</td>
</thead>
<tbody>
<tr v-for="item in $data.role">
<td> item.id </td>
<td> item.name </td>
</tr>
</tbody>
</table>
</div>
通过 vue 输出 $data.role 的 role json:
{ "id": "2", "player_name": "测试未深度维护", "role": [ { "id": "3", "name": "阿三也疯狂1", "is_main": "2" } ] }
但是HTML没反应?是什么问题?怎么使用 data里的 role。
我以使用过
1、<tr v-for="item in role">
2、<tr v-for="item in $data.role">
3、<tr v-for="item in data.role">
4、<tr v-for="item in $data['role']">
5、<tr v-for="item in data['role']">
都是不行的。。求指点。。。
看这吧。。 https://laravist.com/discussion/525 记得 php要全路径!!!!! 哈哈哈
我们都复杂化了。 那些是前端框架的关键字。所以 加@是没有用的。
@openwrtmail 感谢关注。你没有好好看问题。 已经解决了这个问题了。
@JellyBool 手册在哪里。 百度压根就盲区
就是找不到 google 我的又上不去了……