优化代码

This commit is contained in:
java110 2020-10-27 18:37:51 +08:00
parent 343f7f507e
commit 1dbd7845e1
6 changed files with 81 additions and 7 deletions

View File

@ -5,14 +5,14 @@
<block v-for="(item, index) in categoryList" :key="index">
<swiper-item>
<block v-for="(item, index2) in item" :key="index2">
<view class="category-info" v-if="item.href != 'callProperty'">
<view class="category-info" v-if="item.href != 'undefined'">
<navigator @tap="toPage(item.href)">
<image :src="item.src" class="category-image"></image>
<view class="category-text">{{item.name}}</view>
</navigator>
</view>
<view class="category-info" v-if="item.href == 'callProperty'">
<view @tap="callPropertyTel()">
<view class="category-info" v-else>
<view @tap="callUndefined()">
<image :src="item.src" class="category-image"></image>
<view class="category-text">{{item.name}}</view>
</view>
@ -41,6 +41,12 @@
url:pageUrl
})
},
callUndefined:function(){
uni.showToast({
icon:'none',
title:'此功能暂不开放'
})
},
getCategorys: function() {
this.categoryList = {
pageone: [{
@ -54,11 +60,19 @@
}, {
name: "限时秒杀",
src: "/static/images/mall_secKill.png",
href: "/pages/complaint/complaint"
href: "undefined"
}, {
name: "家政服务",
src: "/static/images/mall_secKill.png",
href: "/pages/complaint/complaint"
src: "/static/images/mall_domestic.png",
href: "undefined"
}, {
name: "美食",
src: "/static/images/mall_delicious.png",
href: "undefined"
}, {
name: "超市",
src: "/static/images/mall_supermarket.png",
href: "undefined"
}]
};

View File

@ -0,0 +1,56 @@
<template>
<view class="margin-top-sm">
<view class="text-center">
<text class="recommend-title">为你推荐</text>
</view>
<view class="grid margin-bottom text-center col-2">
<view class="padding-lr-xs margin-top-xs " v-for="(item,indexs) in 4" :key="indexs">
<view class="padding bg-white goods">
<view>
<image class="goods-image" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1603787011106&di=b9c14428500a1ffa46ea52ba1c07702f&imgtype=0&src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201110%2F20%2F104212ds59m9rtqspt6tzt.jpg"></image>
</view>
<view class="margin-top-sm text-left">
<text>迪奥修护精华水迪奥修护精华水</text>
</view>
<view class="flex justify-between margin-top-xs">
<view>
<text class="text-red">86.5</text>
</view>
<view>
<text class="text-gray">销量100件</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
.recommend-title{
font-size: 36upx;
font-weight: 600;
}
.goods {
border-radius: 20upx;
}
.goods-image {
height: 280upx;
}
</style>

View File

@ -7,6 +7,7 @@
</view>
</view>
<vc-category></vc-category>
<vc-recommend></vc-recommend>
</view>
</template>
@ -15,6 +16,8 @@
import vcCategory from '@/components/vc-category/vc-category.vue'
import vcRecommend from '@/components/vc-recommend/vc-recommend.vue'
export default {
data() {
return {
@ -22,7 +25,8 @@
}
},
components:{
vcCategory
vcCategory,
vcRecommend
},
methods: {

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB