From a42c9a1ba39554e818d81e2af1bb9b6369a0cc55 Mon Sep 17 00:00:00 2001 From: asd <374367073@qq.com> Date: Thu, 19 Dec 2019 11:10:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/classify/list/index.js | 4 +- components/classify/navigation/index.js | 18 ++-- components/classify/navigation/index.wxml | 5 +- pages/classify/classify.js | 105 ++++++++++++---------- pages/classify/classify.wxml | 4 +- 5 files changed, 77 insertions(+), 59 deletions(-) diff --git a/components/classify/list/index.js b/components/classify/list/index.js index 738a0e9..1f2a3b5 100644 --- a/components/classify/list/index.js +++ b/components/classify/list/index.js @@ -1,5 +1,7 @@ Component({ - properties: {}, + properties: { + + }, data: {}, methods: { todetail() { diff --git a/components/classify/navigation/index.js b/components/classify/navigation/index.js index e427181..ef1630d 100644 --- a/components/classify/navigation/index.js +++ b/components/classify/navigation/index.js @@ -1,15 +1,17 @@ Component({ properties: { + types: Array }, data: { - id:0 + id: 0 }, methods: { - select(a){ - // console.log(a.target.dataset.id) - this.setData({ - id:a.target.dataset.id - }) - } + select(a) { + // console.log(this.data.a.target.dataset.id) + // console.log(a.target.dataset.id) + this.setData({ + id: a.target.dataset.id + }) + } } - }) \ No newline at end of file +}) \ No newline at end of file diff --git a/components/classify/navigation/index.wxml b/components/classify/navigation/index.wxml index 86574d6..1630e75 100644 --- a/components/classify/navigation/index.wxml +++ b/components/classify/navigation/index.wxml @@ -1,10 +1,11 @@ - 热门商品 + {{item.name}} + \ No newline at end of file diff --git a/pages/classify/classify.js b/pages/classify/classify.js index 5b6fcb8..494d2e2 100644 --- a/pages/classify/classify.js +++ b/pages/classify/classify.js @@ -1,66 +1,79 @@ // pages/classify/classify.js +import { request } from "../../utils/bin" Page({ - /** - * 页面的初始数据 - */ - data: { + /** + * 页面的初始数据 + */ + data: { + type: [] + }, - }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + request({ + url: "Goods/goodsCategoryList", + data: { + parent_id: 2 + } + }).then((res) => { + // console.log(res) + this.setData({ + type: res.data.result + }) + console.log(this.data.type, 150) + }) - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { + }, - }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { + }, - }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { + }, - }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { + }, - }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { + }, - }, + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { + }, - }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { + }, - }, + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } + } }) \ No newline at end of file diff --git a/pages/classify/classify.wxml b/pages/classify/classify.wxml index ba6b786..fda1a98 100644 --- a/pages/classify/classify.wxml +++ b/pages/classify/classify.wxml @@ -1,4 +1,4 @@ - - + + \ No newline at end of file -- 2.45.2