// index.js // 获取应用实例 const { $http, $util } = getApp().globalData Page({ data: { title: "首页测试", href: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#tabBar", news: [ { id: 1, title: '标题1' }, { id: 2, title: '标题2' }, { id: 3, title: '标题3' }, { id: 4, title: '标题4' } ], childData: "" }, onLoad() { $util.test(); this.getIndex(); }, async getIndex() { let res = await $http.index.getIndex(); console.log(res); }, getUserInfo(e) { console.log(e); }, testMe(e) { let { index } = e.target.dataset; console.log(index); }, getChange(e) { console.log("e.detail ==== : ",e.detail); // this.childData = e.detail; this.setData({ childData: e.detail }); }, bindKeyInput(e) { this.setData({ childData: e.detail.value }) console.log("======== : ",e.detail.value); } })