onload onready
发布于 6 年前 作者 jiajing 4574 次浏览 来自 问答

onLoad: function(options) {

        var user = wx.getStorageSync(‘user’);

        wx.request({

            url: app.url + ‘/Api/GetDefault’,

            data: {

                    yh_id: user.id,

                    yh_tel: user.mobile

            },

            method: ‘post’,

            success: res => {

                if (res.data.isok == ‘yes’) {

                    yemian=res.data.info;

                    this.setData({

                        yemian: yemian

                    });

                }

            }

        })

},

onReady: function() {

    var yemian = this.data.yemian;

    console.log(yemian);

},

问题:执行onload 中的 wx.request,返回值用setData渲染到wxml页面,onReady 是获取setData渲染完毕之后的值还是之前的值

    

        

1 回复

渲染前的!

回到顶部