接口数据
接口返回实例:
{
"message": [
{
"cat_id": 1,
"cat_name": "大家电",
"cat_pid": 0,
"cat_level": 0,
"cat_deleted": false,
"cat_icon": "",
"children": [
{
"cat_id": 3,
"cat_name": "电视",
"cat_pid": 1,
"cat_level": 1,
"cat_deleted": false,
"cat_icon": "",
"children": [
{
"cat_id": 5,
"cat_name": "曲面电视",
"cat_pid": 3,
"cat_level": 2,
"cat_deleted": false,
"cat_icon": "https://api-hmugo-web.itheima.net/full/2fb113b32f7a2b161f5ee4096c319afedc3fd5a1.jpg"
}
]
}
]
}
],
"meta": {
"msg": "获取成功",
"status": 200
}
}
页面布局
<!-- pages/category/index.wxml -->
<view class="cates">
<SearchInput></SearchInput>
<view class="cates-container">
<scroll-view class="left-menu" scroll-y="{
{true}}">
<view class="menu-item {
{index == currentIndex ? 'active': ''}}"
wx:for="{
{leftMenuList}}"
wx:key="*this"
catchtap="handleItemTap"
data-index="{
{index}}">
{
{item}}
</view>
</scroll-view>
<scroll-view class="right-content"