// pages/index/sw/index.js let Common = require('../../../common/common.js') let Http = require('../../../utils/http.js') Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { tabs: [ { key: 1, name: "全部" }, { key: 2, name: "餐饮" }, { key: 3, name: "娱乐" }, { key: 4, name: "服饰" }, { key: 5, name: "超市" }, { key: 6, name: "亲子" }, { key: 7, name: "其他" }, ], list: [ { img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", name: "海鲜焗饭", distance: "12.5km", address: "西单大悦城2F-012A", oPrice: "59.00", pPrice: "1.00", }, { img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", name: "海鲜焗饭", distance: "12.5km", address: "西单大悦城2F-012A", oPrice: "59.00", pPrice: "1.00", }, { img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", name: "海鲜焗饭", distance: "12.5km", address: "西单大悦城2F-012A", oPrice: "59.00", pPrice: "1.00", }, { img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", name: "海鲜焗饭", distance: "12.5km", address: "西单大悦城2F-012A", oPrice: "59.00", pPrice: "1.00", }, { img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", name: "海鲜焗饭", distance: "12.5km", address: "西单大悦城2F-012A", oPrice: "59.00", pPrice: "1.00", }, ], current: '1', current_scroll: '1', }, /** * 组件的方法列表 */ methods: { handleChange({ detail }) { this.setData({ current: detail.key }); }, handleChangeScroll({ detail }) { this.setData({ current_scroll: detail.key }); }, }, ready(){ Common.getCouponList(1, 10) .then(res=>{ console.log(res) this.setData({ list: res.data.data.list }) }) } })