VUE.JS

var vm = new Vue({
            el:"#list",
            data:{
                gridData: "",
            },
            mounted: function() {
                this.$nextTick(function () {
                    this.$http.jsonp('http://***.com').then(function(res) {
                        console.log(res.data)
                        this.gridData = res.data;
                    })
                })
            },
        })

vue2.0版本废弃了ready定义的方法,使用mounted来代替,不过需要加上this.$nextTick(function(){})。

如果没有请求成功看一下vuejs的版本,1.0版本的写法是这样的

var vm = new Vue({
    el:"#list",
    data:{
        gridData: '',
    },
    ready: function() {
        this.$http.jsonp('http://***.com').then(function(res){
            this.$set('gridData', res.data);
        })
    },
})

 

相关文章:

  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2021-07-09
  • 2021-07-16
  • 2021-10-16
猜你喜欢
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案