当前位置:网站首页>The waterfall flow layout demo2 (method 2) used by the uniapp wechat applet (copy and paste can be used without other processing)
The waterfall flow layout demo2 (method 2) used by the uniapp wechat applet (copy and paste can be used without other processing)
2022-07-05 00:05:00 【I'm happy】
design sketch :
<template>
<view class="container">
<view class="left">
<view v-for="(item,index) in leftList" :key="index" class="imgBox">
<image :src="item.img" alt="" mode="widthFix"></image>
<view class="txt">{
{
item.name}}</view>
</view>
</view>
<view class="right">
<view v-for="(item,index) in rightList" :key="index" class="imgBox">
<image :src="item.img" alt="" mode="widthFix"></image>
<view class="txt">{
{
item.name}}</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [{
img: "../../static/home/weixin.png",
name: '0 Name of commodity , Can be very long, very long, very long, very long, very long, very long, very long, very long, very long, very long, very long, very long ',
id: 100
}, {
img: "../../static/home/bg_yjc.png",
name: '1 Name of commodity , Can be very long, very long, very long, very long, very long, very long, very long, very long, very long, very long, very long, very long ',
id: 100
}, {
img: "../../static/home/bg.png",
name: '2 The product name will exceed N Do not fold on line ',
id: 100
},
{
img: "../../static/home/bg.png",
name: '3 When there are only two lines of titles, the height is 39',
id: 100
}, {
img: "../../static/home/bg.png",
name: '4 You can customize the specific style ',
id: 100
}, {
img: "../../static/home/bg_yjc.png",
name: '5vue Of H5 The same is true for pages ',
id: 100
}, {
img: "../../static/img/shenfen1.png",
name: '6 When there is only one line of title ',
id: 100
}, {
img: "../../static/home/bg_yjc.png",
name: '7vue Of H5 The same is true for pages ',
commdityPrice: 100
}, {
img: "../../static/home/bg.png",
name: '8vue Of H5 The same is true for pages ',
commdityPrice: 100
}, {
img: "../../static/home/bg_yjc.png",
name: '9vue Of H5 The same is true for pages ',
commdityPrice: 100
}, {
img: "../../static/home/weixin.png",
name: '10 Name of commodity , Can be very long, very long, very long, very long, very long, very long, very long, very long, very long, very long, very long, very long ',
id: 100
},
], // List of goods ,
// Initialize left and right boxes
leftList: [],
rightList: [],
// Initialize the height of the left and right boxes
leftH: 0,
rightH: 0
}
},
// Page loading
onLoad(e) {
this.doList()
},
// Page shows
onShow() {
},
// Method
methods: {
doList() {
const that = this
this.list.forEach(res => {
// Get the width and height of the picture
uni.getImageInfo({
src: res.img,
success: (image) => {
console.log(res.img)
// Calculate the image rendering height
let showH = (50 * image.height) / image.width
// Judge the height of the left and right boxes
if (that.leftH <= that.rightH) {
that.leftList.push(res)
that.leftH += showH
} else {
that.rightList.push(res)
that.rightH += showH
}
}
})
})
}
},
// Compute properties
computed: {
},
// The listener
watch: {
},
// Page hidden
onHide() {
},
// Page uninstall
onUnload() {
},
// Trigger pull-down refresh
onPullDownRefresh() {
this.pageNum = 1
// this.getListData()
},
// Handling function of page pull bottom event
onReachBottom() {
this.pageNum++
// this.getListData()
},
}
</script>
<style lang="scss" scoped>
.container {
padding: 0 30rpx;
font-size: 14rpx;
line-height: 24rpx;
}
.right,
.left {
display: inline-block;
width: 40%;
vertical-align: top;
.imgBox{
margin-bottom: 25rpx;
.txt{
font-size: 24rpx;
}
}
}
.left {
float: left;
}
.right{
float: right;
}
.left image,
.right image {
width: 100%;
margin-bottom: 10rpx;
}
</style>
Reprint : Thanks for sharing.
Link to the original text :https://blog.csdn.net/He_n_ry/article/details/125242284
边栏推荐
- [JS] - [dynamic planning] - Notes
- Microservice
- Tester's algorithm interview question - find mode
- How many triangles are there in the golden K-line diagram?
- 【kotlin】第三天
- 圖解網絡:什麼是網關負載均衡協議GLBP?
- 人生无常,大肠包小肠, 这次真的可以回家看媳妇去了。。。
- Using the uniapp rich text editor
- js如何实现数组转树
- [path planning] RRT adds dynamic model for trajectory planning
猜你喜欢

In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database

快解析内网穿透帮助企业快速实现协同办公

How to avoid arc generation—— Aafd fault arc detector solves the problem for you

如何报考PMP项目管理认证考试?

Application of fire fighting system based on 3D GIS platform

Significance of acrel EMS integrated energy efficiency platform in campus construction

French scholars: the explicability of counter attack under optimal transmission theory

How to do the project of computer remote company in foreign Internet?

机器人强化学习——Learning Synergies between Pushing and Grasping with Self-supervised DRL (2018)

快解析——好用的内网安全软件
随机推荐
PermissionError: [Errno 13] Permission denied: ‘data. csv‘
XML的解析
取得PMP证书需要多长时间?
How many triangles are there in the golden K-line diagram?
[path planning] RRT adds dynamic model for trajectory planning
【雅思阅读】王希伟阅读P4(matching2段落信息配对题【困难】)
Intelligence test to see idioms guess ancient poems wechat applet source code
Best practice case of enterprise digital transformation: introduction and reference of cloud based digital platform system security measures
Pytoch --- use pytoch to realize linknet for semantic segmentation
JS convert pseudo array to array
Tester's algorithm interview question - find mode
PMP certificate renewal process
[JS] - [sort related] - Notes
雅思考试流程、需要具体注意些什么、怎么复习?
Chinese verification of JS regular expressions (turn)
实战模拟│JWT 登录认证
IELTS examination process, what to pay attention to and how to review?
Data on the number of functional divisions of national wetland parks in Qinghai Province, data on the distribution of wetlands and marshes across the country, and natural reserves in provinces, cities
Date time type and format in MySQL
Actual combat simulation │ JWT login authentication