goTo:function (id) {
        const q =wx.createSelectorQuery();
        q.select("#"+id).boundingClientRect();
        q.selectViewport().scrollOffset();
        q.exec((res)=>{
            if(res[0] && res[1]){
                console.log("跳转",res[0].top+res[1].scrollTop);
                wx.pageScrollTo({
                    scrollTop:res[0].top+res[1].scrollTop -100,
                    duration:300
                })
            }
        })
    },
    setToView:function (room_id, bed_id) {
        var toView = 'room_bed_'+ room_id + '_' + bed_id;
        console.log("toView===", toView);

        this.setData({
            toView: toView
        });
        var self = this;
        setTimeout(function () {
            console.log("self.data.toView===", self.data.toView);
            self.goTo(self.data.toView);
        }, 1000);

    }


声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权