当前位置:网站首页>uni-app微信小程序——商城(4)——商家
uni-app微信小程序——商城(4)——商家
2022-07-17 00:05:00 【徐小硕】
上一篇文章介绍了商城主页的内容,商城主页也是默认的小程序进入的首页,主要介绍商品的类型和商品展示。本篇文章将会介绍商家一些信息,具体的内容还没有完善,只是对商家不同的类别进行分类展示,没有对商家做具体的内容介绍,后续会逐渐完善,然后再更新本章内容
效果图如下所示:

具体的代码如下:
<template>
<view class="shopContent">
<view class="header">
<van-row>
<!-- 搜索框 -->
<van-col span="24">
<van-search :value="searchValue" shape="round" placeholder="请输入搜索关键词" show-action @change="onChange" @search="onSearch" />
</van-col>
</van-row>
</view>
<view class="nav">
<van-tree-select
:items="shopList"
:main-active-index.sync="mainActive"
:active-id="activeId"
@click-nav="onNavClick"
@click-item="onClickItem"
>
<template slot="content">
</template>
</van-tree-select>
</view>
</view>
</template>
<script>
export default {
data() {
return {
searchValue: '',
//商铺列表
shopList:[],
mainActive:0,
activeId:0,
}
},
onLoad() {
//获取商铺信息
this.getShopData();
},
methods: {
/* 搜索onChange */
onChange(e) {
this.value = e.detail
},
/* 搜索onSearch */
onSearch() {
},
//获取商铺信息
getShopData(){
var data = {
"shops": [{
"activeId": 0,
"text": "全部商铺",
"children":[{
"id":1,
"text":"每日优鲜0",
},
{
"id":2,
"text":"水果商铺0",
},
{
"id":3,
"text":"衣衣不舍0",
}]
},
{
"activeId":1,
"text": "人气排名",
"children":[{
"id":11,
"text":"每日优鲜1",
},
{
"id":12,
"text":"水果商铺1",
},
{
"id":13,
"text":"衣衣不舍1",
}]
},
{
"activeId": 2,
"text": "评分排名",
"children":[{
"id":21,
"text":"每日优鲜2",
},
{
"id":22,
"text":"水果商铺2",
},
{
"id":23,
"text":"衣衣不舍2",
}]
},
]
};
this.shopList = data.shops
console.log(this.shopList)
},
//左侧导航点击事件
onNavClick({ detail = {} }) {
console.log(detail.index)
this.mainActive = detail.index
},
//右侧选中事件
onClickItem({detail = {} }){
console.log(detail)
}
}
}
</script>
<style>
.shopContent{
width: 100%;
height: 100%;
margin: 0 ;
}
.header{
width: 100%;
height: 20%;
}
.nav{
width: 100%;
height: 80%;
}
.van-tree-select{
height: 100% !important;
}
.van-tree-select__content{
-webkit-flex: 3!important;
flex: 3!important;
}
</style>
虽然做的页面比较简单,功能也比较少,但是具体的业务流程还是实现的,后续我会一点点具体完善该功能模块,添加商家的详情页面等等
该页面主要使用了Vant Weapp中的van-tree-select组件,分类选择,来实现对商家店铺不同种类的分类。
本章就先写到这里,如有不足,还望斧正,谢谢~
边栏推荐
- Maker-鸿蒙应用开发培训04
- Day07 ORM table relationship and operation
- 深度之眼三——(4,5)】数学:矩阵特征值与特征向量2
- 记录一次easy_sql堆叠注入
- Three activation functions (relu, sigmoid, tanh) and multilayer perceptron
- 缤纷彩色文字广告代码,文字广告代码美化版,给网站添加文字广告教程
- promise
- C Programming Language(2nd Edition)--读书笔记--1.5
- Day05-Cookie,Session,Csrf
- Use NN in pytoch to realize linear regression (simple implementation)
猜你喜欢

Registry hijacking triggers malicious programs

MoveIt2——4.机器人模型和机器人状态

gtest与gmock的安装与使用
![[GFCTF 2021]Baby_ Cve-2021-41773 on the web](/img/e0/7541860509b3b77f758447e377f2f7.png)
[GFCTF 2021]Baby_ Cve-2021-41773 on the web

@Configurationproperties annotation usage

深度之眼三——(6)】数学:矩阵对角化及二次型1

ModelArts-人声检测and文本分类

jsx 编译

Cve-2022-34265 Django extract & TRUNC SQL injection vulnerability recurrence
![BUUCTF [BJDCTF2020]EzPHP1详解](/img/10/d2593dff2f4a5f0ca41a9f651128df.png)
BUUCTF [BJDCTF2020]EzPHP1详解
随机推荐
当 std::bind 遇上 this
1. Internet foundation
js截取字符串前几位或者截取字符串后几位
深度之眼三——(4,5)】数学:矩阵特征值与特征向量2
Stack injection [strong net cup 2019] random note
堆叠注入之[强网杯 2019]随便注
Day04 routing layer
uniapp中text-indent不起作用,uniapp首行缩进不管用如何解决?
Day13-混入视图基类
Pytoch simply uses the Minist dataset
Recording multiple environments at a time leads to code bugs
uni 阻止按钮多次点击 按钮多次点击
MoveIt2——5.场景规划
关于外键的引用,跨域头部,ref的用法
Day12-关联序列化处理
CobalStrike的部署(附带资源)
(四)运算符
uni-app微信公众号(5)——新增、修改地址
1.互联网基础
ModelArts-人声检测and文本分类