Fetch the repository succeeded.
<template>
<!-- #ifdef APP -->
<!-- <scroll-view style="flex:1"> -->
<!-- #endif -->
<view class="category">
<easy-sidebar :list="list" @change="onChange"></easy-sidebar>
<scroll-view class="right" @scroll="scroll" :scroll-top="scrollTop">
<view class="" v-for="(_,idx) in 4" :key="idx" ref="refList">
<text class="right-title">{{list[idx]}}</text>
<view class="right-box">
<view class="right-good" v-for="(item,index) in goodList" :key="index">
<image :src="cdn(item.image)" class="right-good-image"></image>
<text class="right-good-text">{{item.text}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
<!-- #ifdef APP -->
<!-- </scroll-view> -->
<!-- #endif -->
</template>
<script>
type listItem = { text : string, image : string, link ?: string, price ?: string }
export default {
data() {
return {
list: ['手机数码', '服饰箱包', '家具百货', '美容美妆'] as string[],
goodList: [{ image: '/cate1.jpg', text: '全面屏手机' },
{ image: '/cate2.jpg', text: '全面屏手机' },
{ image: '/cate3.jpg', text: '全面屏手机' },
{ image: '/cate4.jpg', text: '全面屏手机' },
{ image: '/cate5.jpg', text: '全面屏手机' },
{ image: '/cate6.jpg', text: '全面屏手机' },
{ image: '/cate7.jpg', text: '全面屏手机' },] as listItem[],
scrollNode: [] as Element[] ,
scrollTop:0
};
},
onReady(){
this.scrollNode=this.$refs['refList'] as Element[];
},
methods: {
onChange(index: number) {
let rect = this.scrollNode[index].getBoundingClientRect();
this.scrollTop=rect.top
},
cdn(url : String) : string {
return "https://cdn.mzyun.tech/shop" + url;
},
scroll(e : ScrollEvent) {
console.log(e.detail.scrollTop)
},
}
}
</script>
<style lang="scss">
.category {
display: flex;
flex-direction: row;
.right {
flex: 1;
padding: 5px;
.right-title {
margin: 10px 0;
}
.right-box {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
background-color: #fff;
border-radius: 5px;
.right-good {
display: flex;
flex-direction: column;
align-items: center;
margin: 10px 0;
.right-good-image {
width: 60px;
height: 60px;
}
.right-good-text {
font-size: 14px;
}
}
}
}
}
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。