123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <template>
- <view class="content hflex jbetween">
- <scroll-view scroll-y="true" style="height: 1190rpx;">
- <view :style="[MobileLeft]">
- <view v-show="!isNav">
- <view v-for="(item,index) in menuLists" :class="menuIndex==index ? 'menuListSelect' : 'menuList' " @click="selectMenu(index,item)">
- {{item.title}}
- </view>
- </view>
- <view v-show="isNav">
- <slot name="nav"></slot>
- </view>
- <view :style="[foot]"></view>
- </view>
- </scroll-view>
- <scroll-view scroll-y="true" style="height: 1190rpx;">
- <view :style="[MobileRight]">
- <view v-show="!isSlot">
- <view class="goodsList hflex acenter jbetween" v-for="(it,index) in goods">
- <image :src="it.img" style="width: 144rpx;height: 144rpx;border-radius: 16rpx;" mode="aspectFill"></image>
- <view class="goodsDesc">
- <text class="goods_text">{{it.label}}</text>
- <!-- <view class="hot">月销量{{it.hot}}</view> -->
- <view class="hflex acenter jbetween">
- <view class="price">¥{{it.price}}元</view>
- <image src="/static/images/shop/add-cart.png" style="width: 44rpx;height: 44rpx;"></image>
- </view>
- <!-- <view class="type" @tap="onClick(it)">选规格</view> -->
- </view>
- </view>
- </view>
- <view v-show="isSlot">
- <slot name="list"></slot>
- </view>
- <!-- <view :style="[foot]"></view> -->
- </view>
- </scroll-view>
-
- </view>
- </template>
- <script>
- export default {
- props:{
- menuLists:{
- type:[Array,Number,Object],
- default:[]
- },
- bottomSize:{
- type:String,
- default:'0rpx'
- },
- isSlot:{
- type:Boolean,
- default:false
- },
- isNav:{
- type:Boolean,
- default:false
- }
- },
- data() {
- return {
- menuIndex: 0,
- goods:[],
- height:'',
- title:''
- }
- },
- created() {
- //设置手机的高度
- var me = this
- uni.getSystemInfo({
- success: function (res) {
- me.height = res.windowHeight
- }
- });
- if(this.menuLists == []){
-
- }
- this.goods = this.menuLists[0].goods
- },
- mounted() {
- },
- computed:{
- // 右侧产品样式
- MobileRight(){
- let style = {}
- // style.position = 'fixed'
- // style.right = '0rpx'
- style.width = '520rpx'
- style.height = this.height +'px'
- style.right = "3rpx"
- style.backgroundColor = '#FFFFFF'
- style.overflow = 'auto'
- return style
- },
- //左侧菜单样式
- MobileLeft(){
- let style = {}
- // style.position = 'fixed'
- // style.left = '0rpx'
- style.width = '230rpx'
- style.height = this.height +'px'
- style.backgroundColor = '#f3f4f6'
- style.overflow = 'auto'
- return style
- },
- // 产品图片样式
- ImgStyle(){
- let style = {}
- style.width = this.imgSize
- style.height = this.imgSize
- style.marginTop = '10rpx'
- return style
- },
- //底部距离
- foot(){
- let style = {}
- style.width = '100%'
- style.float = 'left'
- style.height = this.bottomSize
- return style
- }
- },
- methods: {
- // 菜单选择
- selectMenu(index,data){
- this.menuIndex = index
- this.goods = this.menuLists[index].goods
- this.title = this.menuLists[index].title
- this.$emit('listenMenu',data);
- },
- // 点击规格
- onClick(e) {
- this.$emit('listenEvent',e);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .menuList{
- text-align: center;
- padding: 20rpx 10rpx;
- font-size: 30rpx;
- }
- .menuListSelect{
- text-align: center;
- background-color: #FFFFFF;
- padding: 30rpx 0rpx;
- font-size: 32rpx;
- font-weight: bold;
- }
- .goodsList{
- float: left;
- border-bottom: 1rpx solid #f3f4f6;
- padding: 10rpx;
- text{
- font-weight: bold;
- font-size: 32rpx;
- }
- }
- .title{
- font-weight: bold;
- font-size: 32rpx;
- padding: 10rpx;
- }
- .hot{
- color: red;
- margin-top: 10rpx;
- font-size: 26rpx;
- }
- .price{
- margin-top: 10rpx;
- font-size: 28rpx;
- font-weight: bold;
- color: #FF2626;
- }
- .type{
- margin-left: 180rpx;
- width: 105rpx;
- display:inline-block;
- margin-bottom: 10rpx;
- background-color: #dd6161;
- padding: 5rpx 10rpx;
- border-radius: 10rpx;
- color: #FFFFFF;
- text-align: center;
- font-size: 26rpx;
- }
- .goodsDesc{
- width: calc(100% - 164rpx);
- margin-left: 25rpx;
- float: right;
- }
- .goods_text {
- font-size: 28rpx;
- font-weight: 500;
- color: #222222;
- line-height: 40rpx;
- text-overflow: ellipsis;
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- box-orient: vertical;
- line-clamp: 2;
- -webkit-line-clamp: 2;
- margin-bottom: 16rpx;
- }
- </style>
|