|
|
@ -1,12 +1,13 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<u-swiper name='images' border-radius='1' :duration='duration' :interval='interval' :height="height"
|
|
|
|
<u-swiper border-radius='1' :duration='duration' :interval='interval' :height="height" :list="swiperList">
|
|
|
|
:list="swiperList"></u-swiper>
|
|
|
|
</u-swiper>
|
|
|
|
<u-divider margin-top='20' margin-bottom='20' color="#F3AF28">热门推荐</u-divider>
|
|
|
|
<u-divider margin-top='20' margin-bottom='20' color="#F3AF28">店长推荐</u-divider>
|
|
|
|
<view class="wrap">
|
|
|
|
<view class="wrap">
|
|
|
|
<u-waterfall v-model="flowList" ref="uWaterfall1">
|
|
|
|
<u-waterfall v-model="flowList" ref="uWaterfall">
|
|
|
|
<template v-slot:left="{leftList}">
|
|
|
|
<template v-slot:left="{leftList}">
|
|
|
|
<view class="demo-warter" v-for="(item, index) in leftList" :key="index">
|
|
|
|
<view class="demo-warter" v-for="(item, index) in leftList" :key="index">
|
|
|
|
<u-lazy-load @click="toDetails(item)" threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
|
|
|
|
<!-- 警告:微信小程序中需要hx2.8.11版本才支持在template中结合其他组件,比如下方的lazy-load组件 -->
|
|
|
|
|
|
|
|
<u-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
|
|
|
|
<view class="demo-title">
|
|
|
|
<view class="demo-title">
|
|
|
|
{{item.title}}
|
|
|
|
{{item.title}}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
@ -17,13 +18,13 @@
|
|
|
|
<view class="demo-title">
|
|
|
|
<view class="demo-title">
|
|
|
|
/份
|
|
|
|
/份
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<image @click="toDetails(item)" class="carimg" :src="carimg"></image>
|
|
|
|
<image class="carimg" :src="carimg"></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<template v-slot:right="{rightList}">
|
|
|
|
<template v-slot:right="{rightList}">
|
|
|
|
<view class="demo-warter" v-for="(item, index) in rightList" :key="index">
|
|
|
|
<view class="demo-warter" v-for="(item, index) in rightList" :key="index">
|
|
|
|
<u-lazy-load @click="toDetails(item)" threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
|
|
|
|
<u-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
|
|
|
|
<view class="demo-title">
|
|
|
|
<view class="demo-title">
|
|
|
|
{{item.title}}
|
|
|
|
{{item.title}}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
@ -34,7 +35,7 @@
|
|
|
|
<view class="demo-title">
|
|
|
|
<view class="demo-title">
|
|
|
|
/份
|
|
|
|
/份
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<image @click="toDetails(item)" class="carimg" :src="carimg"></image>
|
|
|
|
<image class="carimg" :src="carimg"></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -46,7 +47,6 @@
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
ref
|
|
|
|
ref
|
|
|
|
} from 'vue';
|
|
|
|
} from 'vue';
|
|
|
|
//购物车图片
|
|
|
|
|
|
|
|
const carimg = ref('/static/goodscar.png')
|
|
|
|
const carimg = ref('/static/goodscar.png')
|
|
|
|
//轮播图高度
|
|
|
|
//轮播图高度
|
|
|
|
const height = ref('400')
|
|
|
|
const height = ref('400')
|
|
|
@ -58,47 +58,57 @@
|
|
|
|
const interval = ref(2000)
|
|
|
|
const interval = ref(2000)
|
|
|
|
//滑动动画时长
|
|
|
|
//滑动动画时长
|
|
|
|
const duration = ref(500)
|
|
|
|
const duration = ref(500)
|
|
|
|
//定义轮播图数据
|
|
|
|
//定义轮播图的数据
|
|
|
|
const swiperList = ref([{
|
|
|
|
const swiperList = ref([{
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/swipper1.png'
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/swipper2.png'
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/swipper3.png'
|
|
|
|
}])
|
|
|
|
}])
|
|
|
|
//瀑布流数据
|
|
|
|
//列表数据
|
|
|
|
const flowList = ref([{
|
|
|
|
const flowList = ref([{
|
|
|
|
price: 75,
|
|
|
|
price: 20,
|
|
|
|
title: '小炒肉盖饭',
|
|
|
|
title: '小炒肉盖饭',
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/test-5.png',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
price: 385,
|
|
|
|
price: 12,
|
|
|
|
title: '手拉面',
|
|
|
|
title: '手拉面',
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/test-8.png',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
price: 784,
|
|
|
|
price: 10,
|
|
|
|
title: '小笼包',
|
|
|
|
title: '小笼包',
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/test-5.png',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
price: 7891,
|
|
|
|
price: 15,
|
|
|
|
title: '馄饨',
|
|
|
|
title: '馄饨',
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/test-8.png',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
price: 2341,
|
|
|
|
price: 18,
|
|
|
|
title: '香菇肉片盖饭',
|
|
|
|
title: '香菇肉片盖饭',
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/test-8.png',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
price: 2342,
|
|
|
|
price: 15,
|
|
|
|
title: '番茄鸡蛋盖饭',
|
|
|
|
title: '番茄鸡蛋盖饭',
|
|
|
|
image: '/static/swiper_1.png'
|
|
|
|
image: '/static/test-8.png',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
price: 18,
|
|
|
|
|
|
|
|
title: '香菇肉片盖饭',
|
|
|
|
|
|
|
|
image: '/static/test-8.png',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
price: 15,
|
|
|
|
|
|
|
|
title: '番茄鸡蛋盖饭',
|
|
|
|
|
|
|
|
image: '/static/test-8.png',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
])
|
|
|
|
])
|
|
|
|
//跳转至详情
|
|
|
|
//跳转详情
|
|
|
|
const toDetails = (item) => {
|
|
|
|
const toDetails = (item) => {
|
|
|
|
//在起始页面跳转到details.vue页面并传递参数
|
|
|
|
//在起始页面跳转到details.vue页面并传递参数
|
|
|
|
uni.navigateTo({
|
|
|
|
uni.navigateTo({
|
|
|
@ -107,7 +117,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
<style lang="scss">
|
|
|
|
.content {
|
|
|
|
.content {
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-direction: column;
|
|
|
@ -140,7 +150,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
.demo-warter {
|
|
|
|
.demo-warter {
|
|
|
|
border-radius: 8px;
|
|
|
|
border-radius: 8px;
|
|
|
|
margin: 5px;
|
|
|
|
/* margin: 5px; */
|
|
|
|
background-color: #ffffff;
|
|
|
|
background-color: #ffffff;
|
|
|
|
padding: 5px;
|
|
|
|
padding: 5px;
|
|
|
|
position: relative;
|
|
|
|
position: relative;
|
|
|
@ -194,7 +204,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
.demo-price {
|
|
|
|
.demo-price {
|
|
|
|
font-size: 30rpx;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FF7670;
|
|
|
|
color: $u-type-error;
|
|
|
|
margin-top: 5px;
|
|
|
|
margin-top: 5px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -212,7 +222,7 @@
|
|
|
|
.carimg {
|
|
|
|
.carimg {
|
|
|
|
height: 50rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
width: 50rpx;
|
|
|
|
width: 50rpx;
|
|
|
|
margin-top: 5rpx;
|
|
|
|
margin-top: 5px;
|
|
|
|
margin-left: 8px;
|
|
|
|
margin-left: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|