当前位置:网站首页>uni-app商品分类
uni-app商品分类
2022-07-01 18:44:00 【黑白两客】
<template>
<view class="classify">
<!-- 分类部分 -->
<view class="cate-left">
<view :class="['cate-item',activeIndex==index?'active':'']" v-for="(item,index) in cateList" :key="index" @click="changeActive(index)">{
{item.classifyName}}</view>
</view>
<view class="cate-right">
<view class="cate-content" v-for="(it,id) in 30" :key="id" @click="getto(it)">
<image src="../../static/images/userinfo.jpg" mode=""></image>
<view class="cate-text">好东西</view>
</view>
</view>
</view>
</template>
<script> export default {
data() {
return {
scrollTop: 0, // 初始化的分类列表 cateList: [{
classifyName: '女装', id: 1 }, {
classifyName: '洗护', id: 2 }, {
classifyName: '内衣', id: 3 }, {
classifyName: '百货', id: 4 }, {
classifyName: '饰品', id: 5 }, {
classifyName: '母婴', id: 6 }, {
classifyName: '数码', id: 7 }, {
classifyName: '食品', id: 8 }, {
classifyName: '电器', id: 9 }, {
classifyName: '进口', id: 10 }, {
classifyName: '手机', id: 11 }, {
classifyName: '家装', id: 12 }, {
classifyName: '美妆', id: 13 }], // 当前点击项的索引号 activeIndex: 0, // 分类下的商品信息 goodList: [] }; }, methods: {
async getcateList() {
const res = await uni.$http.get('/classify') console.log(res) const {
data: {
classify, code } } = res if (code != 200) {
return uni.showToast({
title: '加载数据失败', duration: 1000, icon: 'none' }) } else {
this.cateList = classify // 获取第一个分类下的商品 this.goodList = classify[0].children } }, //更改点击项的索引号 changeActive(i) {
this.activeIndex = i // 已经获取到索引号 this.goodList = this.cateList[i].children }, //点击搜索框跳转到搜索页面 getto(it) {
console.log(it,123) uni.navigateTo({
url: '/pages-zzfw/productDisplay-detail/productDisplay-detail' }) }, }, onLoad() {
// this.getcateList() } } </script>
<style lang="scss" scoped> .classify {
background-color: #fff; width: 100%; height: 100%; display: flex; justify-content: space-between; .cate-left {
width: 200rpx; height: 100vh; overflow: auto; background-color: #F6F6F6; .cate-item {
width: 100%; height: 100rpx; line-height: 100rpx; padding-left: 40rpx; box-sizing: border-box; } .active {
background-color: #FFFFFF; position: relative; padding-left: 40rpx; box-sizing: border-box; &::before {
content: ''; display: block; width: 5rpx; border-radius: 6rpx; height: 50rpx; background-color: #FC4353; position: absolute; left: 5rpx; top: 30rpx; } } } .cate-right {
width: 80%; height: 100vh; overflow: auto; .cate-content {
float: left; width: 28%; height: 185rpx; text-align: center; margin: 20rpx 0 0 15rpx; padding: 5rpx; background: #f1f1f1; border-radius: 20rpx; image {
width: 100rpx; height: 100rpx; } .cate-text {
font-size: 34rpx; } } } } </style>
边栏推荐
- Nacos configuration file publishing failed, please check whether the parameters are correct solution
- Lake shore M91 fast hall measuring instrument
- Solution of digital supply chain centralized purchase platform in mechanical equipment industry: optimize resource allocation and realize cost reduction and efficiency increase
- nacos启动失败问题解决与总结
- Lake Shore M91快速霍尔测量仪
- 狼人杀攻略:你当我好骗吗,我们相信谁!
- Dlib+opencv library for fatigue detection
- Netease games, radical going to sea
- Supervarimag superconducting magnet system SVM series
- Download (export) PDF template file (such as approval form), and report error: invalid nested tag * * * found, expected closing tag***
猜你喜欢
Lake Shore—OptiMag 超导磁体系统 — OM 系列
智慧防疫系统为建筑工地复工复产提供安全保障
CDGA|从事通信行业,那你应该考个数据管理证书
生鲜行业B2B电商平台解决方案,提高企业交易流程标准化和透明度
Parallelism, concurrency and life cycle of threads
Witness the times! "The future of Renji collaboration has come" 2022 Hongji ecological partnership conference opens live broadcast reservation
精耕渠道共谋发展 福昕携手伟仕佳杰开展新产品培训大会
Lake Shore低温恒温器的氦气传输线
微信公众号开发相关流程及功能介绍
nacos启动失败问题解决与总结
随机推荐
Netease games, radical going to sea
生鲜行业B2B电商平台解决方案,提高企业交易流程标准化和透明度
Helium transmission line of lake shore cryostat
Download (export) PDF template file (such as approval form), and report error: invalid nested tag * * * found, expected closing tag***
Lake Shore—CRX-EM-HF 型低温探针台
PMP是被取消了吗??
ECS summer money saving secret, this time @ old users come and take it away
June issue | antdb database participated in the preparation of the "Database Development Research Report" and appeared on the list of information technology and entrepreneurship industries
Detailed explanation of JUnit unit test framework
Lake Shore continuous flow cryostat transmission line
MATLAB中subplot函数的使用
求各种极限的方法
CDGA|从事通信行业,那你应该考个数据管理证书
pickle.load报错【AttributeError: Can‘t get attribute ‘Vocabulary‘ on <module ‘__main__‘】
论文阅读【Discriminative Latent Semantic Graph for Video Captioning】
Dom4J解析XML、Xpath检索XML
[pytorch record] distributed training dataparallel and distributeddataparallel of the model
寶,運維100+服務器很頭疼怎麼辦?用行雲管家!
Enabling "new Chinese enterprises", SAP process automation landing in China
PostgreSQL varchar[] array type operation