分类接口
This commit is contained in:
		
							parent
							
								
									c3addc7383
								
							
						
					
					
						commit
						a42c9a1ba3
					
				@ -1,5 +1,7 @@
 | 
			
		||||
Component({
 | 
			
		||||
    properties: {},
 | 
			
		||||
    properties: {
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
    data: {},
 | 
			
		||||
    methods: {
 | 
			
		||||
        todetail() {
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
            })
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
@ -1,10 +1,11 @@
 | 
			
		||||
    <scroll-view class="navigation" scroll-y="{{true}}" bind:tap="select" >
 | 
			
		||||
        <view data-id="0" class="{{id == 0?'on' : ''}}">热门商品</view>
 | 
			
		||||
      <view wx:for="{{types}}" data-id="{{index}}" class="{{id == index?'on' : ''}}">{{item.name}}</view>
 | 
			
		||||
        <!-- <view data-id="0" class="{{id == 0?'on' : ''}}">热门商品</view>
 | 
			
		||||
        <view data-id="1" class="{{id == 1?'on' : ''}}">美容健身</view>
 | 
			
		||||
        <view data-id="2" class="{{id == 2?'on' : ''}}">美容健身</view>
 | 
			
		||||
        <view data-id="3" class="{{id == 3?'on' : ''}}">美容健身</view>
 | 
			
		||||
        <view data-id="4" class="{{id == 4?'on' : ''}}">美容健身</view>
 | 
			
		||||
        <view data-id="5" class="{{id == 5?'on' : ''}}">美容健身</view>
 | 
			
		||||
        <view data-id="6" class="{{id == 6?'on' : ''}}">美容健身</view>
 | 
			
		||||
        <view data-id="7" class="{{id == 7?'on' : ''}}">美容健身</view>
 | 
			
		||||
        <view data-id="7" class="{{id == 7?'on' : ''}}">美容健身</view> -->
 | 
			
		||||
    </scroll-view>
 | 
			
		||||
@ -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 () {
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
<view class="box">
 | 
			
		||||
<navigation></navigation>
 | 
			
		||||
<list></list>
 | 
			
		||||
<navigation types="{{type}}"></navigation>
 | 
			
		||||
<list ></list>
 | 
			
		||||
</view>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user