前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >微信小程序--粉丝列表 样式实现

微信小程序--粉丝列表 样式实现

作者头像
Kindear
发布2020-03-18 16:23:57
2.5K0
发布2020-03-18 16:23:57
举报

微信小程序粉丝列表效果实现

1.效果图

2.代码实现

index.js 部分

代码语言:javascript
复制
data: {
    friends: []
 },

index.wxml

代码语言:javascript
复制
<view class="box transition" wx:if="{{friends.length}}">
  <view class="title">我的粉丝</view>
  <view class="user-panel" wx:for="{{friends}}" wx:key="index">
    <image class="head" src="{{item.avatarUrl }}"></image>
    <view class="center">
      <view class="name">
        <text class="name-text">{{item.name}}</text>
        <i class="iconfont {{item.gender ? 'nan' : 'nv'}}"></i>
      </view>
      <view class="code">发帖 {{item.post}} 粉丝 {{item.fans}}</view>
    </view>
    <view class="follow {{item.isFollow ? 'follows' : ''}}" data-id="{{item._id}}" bindtap="handleFollow">{{item.isFollow ? "已关注" : "关注"}}</view>
  </view>
</view>

index.json

代码语言:javascript
复制
{
  "usingComponents": {},
  "navigationBarTitleText": "粉丝列表",
  "backgroundColor": "#f6f6f6"
}

index.wxss

代码语言:javascript
复制
page {
  background-color: #f6f6f6;
}

.title {
  background-color: #fff;
  color: #000;
  font-weight: bold;
  font-size: 28rpx;
  padding: 20rpx 20rpx 20rpx 40rpx;
  margin-top: 20rpx;
  border-bottom: 2rpx solid #f6f6f6;
  position: relative;
}

.title::after {
  content: "";
  display: block;
  width: 6rpx;
  height: 20rpx;
  background-color: #f40000;
  position: absolute;
  left: 20rpx;
  top: 50%;
  margin-top: -10rpx;
  z-index: 1;
}

.box {
  background-color: #fff;
}

.user-panel {
  margin: 0 20rpx;
  padding: 20rpx 0;
  display: flex;
  align-items: center;
  border-bottom: 2rpx solid #f6f6f6;
}

.head {
  flex-shrink: 0;
  width: 80rpx;
  height: 80rpx;
  margin-right: 20rpx;
}

.center {
  flex-grow: 1;
  height: 80rpx;
}

.name {
  display: flex;
  align-items: center;
}

.name-text {
  font-size: 28rpx;
  font-weight: bold;
  color: #333;
  margin-right: 20rpx;
}

.nan {
  font-size: 22rpx;
  color: #1296db;
  margin-top: 6rpx;
}

.nv {
  font-size: 24rpx;
  color: #ff3ec9;
  margin-top: 6rpx;
}

.code {
  font-size: 24rpx;
  color: #999;
  margin-top: 6rpx;
}

.follow {
  flex-shrink: 0;
  width: 90rpx;
  height: 40rpx;
  font-size: 24rpx;
  color: #fff;
  text-align: center;
  line-height: 40rpx;
  border-radius: 6rpx;
  background-color: #f40000;
}

.follows {
  background-color: #eee;
}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-03-17 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 微信小程序粉丝列表效果实现
相关产品与服务
云开发 CloudBase
云开发(Tencent CloudBase,TCB)是腾讯云提供的云原生一体化开发环境和工具平台,为200万+企业和开发者提供高可用、自动弹性扩缩的后端云服务,可用于云端一体化开发多种端应用(小程序、公众号、Web 应用等),避免了应用开发过程中繁琐的服务器搭建及运维,开发者可以专注于业务逻辑的实现,开发门槛更低,效率更高。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档