当前位置:网站首页>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>

边栏推荐
- Lake shore M91 fast hall measuring instrument
- 奔赴山海之前,毕业季一定要做的那些事情
- Specification of lumiprobe reactive dye indocyanine green
- PMP是被取消了吗??
- The market value evaporated by 74billion yuan, and the big man turned and entered the prefabricated vegetables
- Supervarimag superconducting magnet system SVM series
- SuperOptiMag 超导磁体系统 — SOM、SOM2 系列
- The difference between indexof and includes
- Appgallery connect scenario development practice - image storage and sharing
- Solution of intelligent supply chain management platform in aquatic industry: support the digitalization of enterprise supply chain and improve enterprise management efficiency
猜你喜欢

PMP是被取消了吗??

Nacos configuration file publishing failed, please check whether the parameters are correct solution

XML语法、约束

Lake shore M91 fast hall measuring instrument

正则表达式=Regex=regular expression

C-end dream is difficult to achieve. What does iFLYTEK rely on to support the goal of 1billion users?

Is PMP cancelled??

Once the SQL is optimized, the database query speed is increased by 60 times

【森城市】GIS数据漫谈(一)

Solidity - contract structure - error - ^0.8.4 NEW
随机推荐
Lake Shore continuous flow cryostat transmission line
Lumiprobe free radical analysis h2dcfda instructions
Digital business cloud: from planning to implementation, how does Minmetals Group quickly build a new pattern of digital development?
English语法_形容词/副词3级 -注意事项
【Go ~ 0到1 】 第五天 7月1 类型别名,自定义类型,接口,包与初始化函数
求各种极限的方法
pickle.load报错【AttributeError: Can‘t get attribute ‘Vocabulary‘ on <module ‘__main__‘】
The use of subplot function in MATLAB
论文阅读【Discriminative Latent Semantic Graph for Video Captioning】
transform + asm资料
English grammar_ Adjective / adverb Level 3 - precautions
Native JS creates a calendar - supports mouse wheel scrolling to select months - and can be ported to any framework
原生js打造日程表-支持鼠标滚轮滚动选择月份-可以移植到任何框架中
从零开始学 MySQL —数据库和数据表操作
nacos启动失败问题解决与总结
Download (export) PDF template file (such as approval form), and report error: invalid nested tag * * * found, expected closing tag***
Superoptimag superconducting magnet system - SOM, Som2 series
XML syntax, constraints
数商云:从规划到落地,五矿集团如何快速构建数字化发展新格局?
Yyds dry inventory ravendb start client API (III)