Page.prototype就是this;
你在任何一個Page里面都可以使用route字段和setData()函數;
示例代碼:
/** * 生命周期函數--監聽頁面加載 */ onLoad: function (options) { this.setData({ name1: 'Apple', name2: 'wechat' }) }, /** * 生命周期函數--監聽頁面初次渲染完成 */ onReady: function () { console.log("route = ", this.route); console.log("name1 = ", this.data.name1); console.log("name2 = ", this.data.name2); },
運行結果: