往往需要写到点赞的功能,并且显示点赞数,如图:
![](https://i-blog.csdnimg.cn/blog_migrate/4bad0134430a13d420d064f7ef3a2887.png)
wxml中输入:
<view class="like">
<image src='images/like.png'></image>
<text>9</text>
</view>
wxss中输入:
.like{
display: flex;
flex-direction: row;
width: 120rpx; /* 必须指定宽度,否则会出现移动 */
padding: 10rpx;
}
.like image{
width: 32rpx;
height: 28rpx;
}
.like text{
font-size: 24rpx;
color: #bbbbbb;
line-height: 24rpx;
position:relative;
bottom:10rpx;
left:6rpx;
}