小程序简易表格

 效果如图:

直接上代码! 

        <view class="tableView">
          <view class="table_header1">
            <view class="th_1">排名情况</view>
          </view>
          <view class="table_header2">
            <view class="th_2 th1">排名</view>
            <view class="th_2 th2">员工</view>
            <view class="th_2 th3">完成/目标</view>
          </view>
          <!-- <block> 并不是一个组件,它仅仅是一个包装元素,不会在页面中做任何渲染,只接受控制属性。 -->
          <block wx:for="{{ listData }}" wx:for-item="work" wx:key="key">
            <view class="table_cell">
              <view class="td td1">{{work.id}}</view>
              <view class="td td2">{{work.name}}</view>
              <view class="td td3">{{work.content}}</view>
            </view>
          </block>

        </view>

JS 

  data = {
    listData: [
      { id: '1', name: '张三', content: '4/1' },
      { id: '2', name: '李四', content: '4/4' },
      { id: '3', name: '王某某', content: '4/2' },
      { id: '4', name: '章某', content: '4/4' },
    ],
  }
  watch = {}

CSS

// 表格部分
.tableView {
  border: 1px solid #000;
  border-right: 0;
  border-bottom: 0;
  width: 98%;
  margin-left: 1%;
}
/* 表头1 */
.table_header1 {
  display: flex;
  background-color: #f9f9f9;
  justify-content: space-between; /* 项目位于各行之间留有空白的容器内。 */
  width: 100%;
  font-size: 25rpx;
  color: #330e0e;
  text-align: center;
  font-weight: 900;
}
/* 表头2 */
.table_header2 {
  display: flex;
  justify-content: space-between; /* 项目位于各行之间留有空白的容器内。 */
  width: 100%;
  font-size: 25rpx;
  color: #330e0e;
  text-align: center;
  font-weight: 900;
}
.th_2 {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60rpx;
  border-bottom: 1px solid #000;
  border-right: 1px solid #000;
}
.th_1 {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60rpx;
  border-bottom: 1px solid #000;
  border-right: 1px solid #000;
}
.th1,
.th2 {
  width: 20%;
}
.th3 {
  width: 60%;
}
/* 表格cell */
.table_cell {
  display: flex;
  justify-content: space-between; /* 项目位于各行之间留有空白的容器内。 */
  width: 100%;
  font-size: 25rpx;
  color: #330e0e;
  text-align: center;
}
.td {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60rpx;
  border-bottom: 1px solid #000;
  border-right: 1px solid #000;
}
.td1,
.td2 {
  width: 20%;
}
.td3 {
  width: 60%;
}

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值