推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

109 lines
2.1 KiB

<template>
<view class="page">
<navbar title="商品列表" leftClick @leftClick="$utils.navigateBack" />
<view class="search">
<uv-search
placeholder="搜你喜欢的产品"
bgColor="#fff"
@search="getData"
@custom="getData"
v-model="queryParams.title"></uv-search>
</view>
<view class="category">
<uv-vtabs
:list="category"
keyName="title"
:barItemBadgeStyle="{right:'20px',top:'12px'}"
@change="change">
<uv-vtabs-item>
<view class="list">
<productItem
v-for="(item, index) in list"
:key="index"
:item="item"
@click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)"
/>
</view>
</uv-vtabs-item>
</uv-vtabs>
</view>
</view>
</template>
<script>
import productItem from '@/components/product/productItem.vue';
import mixinsList from '@/mixins/list.js'
import { mapState } from 'vuex'
export default {
mixins : [mixinsList],
components: {
productItem,
},
data() {
return {
mixinsListApi : 'getClassShopPageList',
}
},
computed: {
...mapState(['category'])
},
onLoad({search}) {
if(search){
this.queryParams.title = search
}
this.$store.commit('getCategoryList')
if(this.category.length > 0){
this.queryParams.classId = this.category[0].id
}
},
methods: {
change(e) {
this.queryParams.classId = this.category[e].id
this.getData()
},
}
}
</script>
<style scoped lang="scss">
.page{
/deep/ .uv-vtabs{
height: calc(100vh - 220rpx) !important;
}
/deep/ .uv-vtabs__bar{
height: calc(100vh - 220rpx) !important;
}
/deep/ .uv-vtabs__content{
height: calc(100vh - 220rpx) !important;
}
.search {
position: relative;
background: #FFFFFF;
margin: 20rpx;
border-radius: 41rpx;
padding: 10rpx 20rpx;
display: flex;
align-items: center;
/deep/ .uv-search__action {
background-color: $uni-color;
color: #FFFFFF;
padding: 10rpx 20rpx;
border-radius: 30rpx;
}
}
}
.category {
font-size: 30rpx;
color: #333;
.list{
margin: 0 auto;
width: 100%;
}
}
</style>