微信小程序个人中心、我的界面(示例四)

微信小程序个人中心、我的界面,九宫格简单布局(示例四)

微信小程序个人中心、我的界面,超简洁的九宫格界面布局,代码粘贴即用。更多微信小程序界面示例,请进入我的主页哦!
个人中心示例界面

1、js代码

Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgPath: '',
    menuList: [
      [{
          'title': '功能一',
          'icon': 'success',
          'iconColor': '#dd6161'
        },
        {
          'title': '功能二',
          'icon': 'success_no_circle',
          'iconColor': 'orange'
        },
        {
          'title': '功能三',
          'icon': 'info',
          'iconColor': '#19be6b'
        }
      ],
      [{
          'title': '功能四',
          'icon': 'warn',
          'iconColor': '#f29100'
        },
        {
          'title': '功能五',
          'icon': 'waiting',
          'iconColor': '#909399'
        },
        {
          'title': '功能六',
          'icon': 'cancel',
          'iconColor': '#606266'
        }
      ],
      [{
          'title': '功能七',
          'icon': 'download',
          'iconColor': 'purple'
        },
        {
          'title': '功能八',
          'icon': 'search',
          'iconColor': '#18b566'
        },
        {
          'title': '功能九',
          'icon': 'clear',
          'iconColor': '#f29100'
        },
      ],
    ],
  },
  // 功能监听
  clickBtn(e) {
    let tag = e.currentTarget.dataset.id;
    console.log('点击信息', tag)
  },
  // 菜单监听
  menuClick(e) {
    let tab = e.currentTarget.dataset.item;
    console.log('点击信息', tab)
  },
  // 头像切换
  avatarClick(e) {
    this.setData({
      imgPath: e.detail.avatarUrl
    })
    console.log('点击信息',e.detail.avatarUrl)
  }
})

2、wxml代码

<view class="top-box">
  <block wx:if="{{imgPath==''}}">
    <button class="avatar center" bindchooseavatar="avatarClick" open-type="chooseAvatar">头像</button>
  </block>
  <block wx:else>
    <view class="center">
      <image class="avatar" src="{{imgPath}}" mode="widthFix" />
    </view>
  </block>
  <view class="nick center">三脚猫的喵</view>
</view>
<view class="center-box center">
  <text bind:tap="clickBtn" data-id="0">功能一</text>
  <text>|</text>
  <text bind:tap="clickBtn" data-id="1">功能二</text>
</view>
<!-- 菜单 -->
<view>
  <block wx:for="{{menuList}}" wx:key="itemA" wx:for-item="itemA" wx:for-index="indexA">
    <view class="row-list">
      <block wx:for="{{itemA}}" wx:key="item" wx:for-item="item" wx:for-index="index">
        <view class="tab-col {{(index==1 || index==4 || index==7)?'border':''}}" bind:tap="menuClick" data-item="{{item}}">
          <icon class="icon-item" type="{{item.icon}}" size="30" color="{{item.iconColor}}"></icon>
          <text>{{item.title}}</text>
        </view>
      </block>
    </view>
  </block>
</view>

3、wxss代码

page {
  font-size: 32rpx;
  background-color: #F1F1F1;
}

.avatar {
  width: 140rpx;
  height: 140rpx;
  border-radius: 120rpx;
  padding: 0;
  font-size: 32rpx;
}

.top-box {
  background-color: #44ADFB;
  padding-bottom: 60rpx;
  border-radius: 0 0 30% 30%;
}

.center {
  display: flex;
  align-items: center;
  flex-direction: row;
  justify-content: center;
}

.nick {
  margin: 20rpx 0;
  font-size: 34rpx;
  color: white;
}

.center-box {
  margin-top: -40rpx;
  color: #525151;
}

.center-box text {
  background-color: white;
  padding: 20rpx 25rpx;
  text-align: center;
}

.center-box text:nth-child(1) {
  border-radius: 50rpx 0 0 50rpx;
}

.center-box text:nth-child(2) {
  color: #44ADFB;
}

.center-box text:nth-child(3) {
  border-radius: 0 50rpx 50rpx 0;
}

.row-list {
  display: flex;
  flex-direction: row;
  text-align: center;
}

.tab-col {
  width: 33.33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30rpx 0;
  border-bottom: 1rpx solid #FFFFFF;
  color: #525151;
}

.icon-item {
  margin-bottom: 15rpx;
}

.border {
  border-left: 1rpx solid #FFFFFF;
  border-right: 1rpx solid #FFFFFF;
}

4、json代码

{
  "usingComponents": {},
  "navigationBarTitleText": "我的界面",
  "navigationBarBackgroundColor": "#44ADFB"
}

更多微信小程序示例的分享,请进入我的主页查看哦。。。

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-30 18:10:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-30 18:10:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-30 18:10:02       87 阅读
  4. Python语言-面向对象

    2024-04-30 18:10:02       96 阅读

热门阅读

  1. web server apache tomcat11-24-Virtual Hosting and Tomcat

    2024-04-30 18:10:02       33 阅读
  2. 使用std::copy_n 对std::vector 拷贝数据时需要注意

    2024-04-30 18:10:02       35 阅读
  3. GPU系列(一):GPU 与 CPU异同

    2024-04-30 18:10:02       32 阅读
  4. 设计模式(三)、模板方法设计模式

    2024-04-30 18:10:02       35 阅读
  5. 网络安全SQL注入

    2024-04-30 18:10:02       25 阅读
  6. Web安全测试实战:SQL注入与XSS攻击的检测与防御

    2024-04-30 18:10:02       40 阅读
  7. day7 c++

    day7 c++

    2024-04-30 18:10:02      29 阅读