let { home } = getApp().globalData Page({ data: { text: "父组件给子组件的数据", isVip: false, id: 0, keyWord: "", news: [ { id: 1, title: '新闻1' }, { id: 2, title: '新闻2' }, { id: 3, title: '新闻3' }, { id: 4, title: '新闻4' }, ] }, testChange(e) { console.log(e.detail); }, onLoad() { this.getHome() }, async getHome() { let res = await home.index(); console.log(res); }, enterInfo(e) { // console.log("=====: ",e.currentTarget.dataset.id); // wx.navigateTo({ // url: `/pages/info/info?id=${e.currentTarget.dataset.id}`, // }) // this.data.id = e.currentTarget.dataset.id this.setData({ id: e.currentTarget.dataset.id }) console.log(" this.data.id: ", this.data.id); }, bindKeyWord(e) { this.setData({ keyWord: e.detail.value }) } })