当前位置:网站首页>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
边栏推荐
- Is it safe to open and register new bonds? Is there any risk? Is it reliable?
- 实战模拟│JWT 登录认证
- 企业应用业务场景,功能添加和修改C#源码
- How long does it take to obtain a PMP certificate?
- How many triangles are there in the golden K-line diagram?
- 雅思考试流程、需要具体注意些什么、怎么复习?
- go踩坑——no required module provides package : go.mod file not found in current directory or any parent
- It's too convenient. You can complete the code release and approval by nailing it!
- Application of multi loop instrument in base station "switching to direct"
- Font design symbol combination multifunctional wechat applet source code
猜你喜欢

「运维有小邓」域密码策略强化器

如何报考PMP项目管理认证考试?
![[IELTS reading] Wang Xiwei reading P3 (heading)](/img/19/40564f2afc18fe3e34f218b7b44681.png)
[IELTS reading] Wang Xiwei reading P3 (heading)

【kotlin】第三天

Hash table, hash function, bloom filter, consistency hash

如何避免电弧产生?—— AAFD故障电弧探测器为您解决

Application of multi loop instrument in base station "switching to direct"

How to apply for PMP project management certification examination?

如何用快解析自制IoT云平台

In the enterprise, win10 turns on BitLocker to lock the disk, how to back up the system, how to recover when the system has problems, and how to recover quickly while taking into account system securi
随机推荐
ICML 2022 | 3dlinker: e (3) equal variation self encoder for molecular link design
圖解網絡:什麼是網關負載均衡協議GLBP?
45岁教授,她投出2个超级独角兽
Paddleocr tutorial
Power operation and maintenance cloud platform: open the new mode of "unattended and few people on duty" of power system
青海省国家湿地公园功能区划数数据、全国湿地沼泽分布数据、全国省市县自然保护区
业务实现-日志写到同一个行数据里面
Why does infographic help your SEO
Advanced template
Life is changeable, and the large intestine covers the small intestine. This time, I can really go home to see my daughter-in-law...
如何报考PMP项目管理认证考试?
Illustrated network: what is gateway load balancing protocol GLBP?
【北京大学】Tensorflow2.0-1-开篇
Specification for fs4061a boost 8.4v charging IC chip and fs4061b boost 12.6V charging IC chip datasheet
What is the difference between port mapping and port forwarding
How long does it take to obtain a PMP certificate?
[论文阅读] CarveMix: A Simple Data Augmentation Method for Brain Lesion Segmentation
Verilog tutorial (11) initial block in Verilog
微服务(Microservice)那点事儿
Using the uniapp rich text editor