new Vue({
el: '#index',
data: {
UserSetting:null
},
mounted: function() {
var _this = this;
var IMEI = plus.device.imei;
mui.ajax('http://..........', {
data: {
mac: IMEI,
device: 2
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 50000, //超时时间设置为10秒;
success: function(res) {
_this.UserSetting = res;
}
error: function(xhr, type, errorThrown) {
console.log('请求失败');
}
});
}
});
页面:
<div id="index">
<div v-for="i in UserSetting">{{i.DEPT_NAME}}</div>
</div>
补充一下大神要的截图
试了好多方法 什么{} [] null '' 都试了 con出来的是[obj Obj]
console.log(JSON.stringify(_this.UserSetting));
也能出来数据 就是赋值不到UserSetting里面。求大神解答一下 不要和我说后台 后台死了
你倒是把这个打印出来截图看看,尽扯些没用的