【微信小程序 三】用户界面
来源:互联网 发布:创始于淘宝的女装品牌 编辑:程序博客网 时间:2024/06/10 20:39
前端
在app.json中加入以下代码,实现tabBar的导航菜单栏的功能
"tabBar": { "backgroundColor": "#318EE2", "color": "#ffffff", "list": [ { "pagePath": "pages/index/index", "text": "首页", "iconPath": "images/tabbar/2/home2.png", "selectedIconPath": "images/tabbar/2/home.png" }, { "pagePath": "pages/forum/forum", "text": "借书", "iconPath": "images/tabbar/2/scan2.png", "selectedIconPath": "images/tabbar/2/scan.png" }, { "pagePath": "pages/user/user", "text": "我的", "iconPath": "images/tabbar/2/user2.png", "selectedIconPath": "images/tabbar/2/user.png" } ] }
user.js
// user.jsvar _app = getApp()Page({ /** * 页面的初始数据 */ data: { menuitems: [ { text: '账号信息', url: '../userinfo/userinfo', icon: '../../images/usermenu/info.png', tips: '' }, { text: '预订单', url: '../borrowbook/borrowbook?status=N', icon: '../../images/usermenu/order.png', tips: '' }, { text: '借阅历史', url: '../borrowbook/borrowbook?status=F', icon: '../../images/usermenu/history.png', tips: '' }, { text: '待归还', url: '../borrowbook/borrowbook?status=Y', icon: '../../images/usermenu/huan.png', tips: '' }, { text: '个人喜好', url: '../favorcate/favorcate', icon: '../../images/usermenu/favor.png', tips: '' }, ] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let that = this _app.getUserInfo(function (userinfo) { console.log(userinfo) console.log(getApp().globalData.userSign) that.setData({ userinfo: userinfo, userSign: getApp().globalData.userSign, }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { let that = this _app.getUserInfo(function (userinfo) { console.log(userinfo) console.log(getApp().globalData.userSign) that.setData({ userinfo: userinfo, userSign: getApp().globalData.userSign, }) }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }})
user.wxml
<view class="mine-wrapper"> <view class="avatar-wrapper"> <view> <view class="avatar"> <image style="border-radius:50%;" src="{{userinfo.avatarUrl ? userinfo.avatarUrl:'../../images/avatar/avatar_01.png'}}"></image> </view> <view class="text"> <text wx:if="{{userinfo.nickName}}">{{userinfo.nickName}}</text> <text wx:else bindtap="toLogin">注册 / 登录</text> </view> <view class="text"> <text wx:if="{{userSign==2}}">{{"您还没有填写真实信息,暂不能借书"}}</text> <text wx:elif="{{userSign==1}}">{{"会员用户"}}</text> </view> </view> </view> <view class="list-wrapper"> <view class="weui-cells weui-cells_after-title"> <block wx:for="{{menuitems}}" wx:key="menu_for"> <navigator url="{{item.url}}" class="weui-cell weui-cell_access" hover-class="weui-cell_active"> <view class="weui-cell__hd"> <image src="{{item.icon}}"></image> </view> <view class="weui-cell__bd">{{item.text}}</view> <view class="weui-cell__ft weui-cell__ft_in-access">{{item.tips}}</view> </navigator> </block> </view> </view></view>
user.wxss
.avatar-wrapper { background: #1b82d1; padding: 25px 0;}.avatar-wrapper .avatar { margin: 0 auto; text-align: center;}.avatar-wrapper .avatar image { width: 100px; height: 100px;}.avatar-wrapper .text { text-align: center; color: #fff;}.weui-cell__hd image { margin-right: 5px; vertical-align: middle; width: 20px; height: 20px;}.weui-cells::after{ content: none; border-bottom: none;}.weui-cells::before{ border-top: none;}/* user.wxss */
阅读全文
0 0
- 【微信小程序 三】用户界面
- 用户界面之 view 三
- 三,用户界面测试
- 第八章 用户界面(三)
- Android应用程序用户界面(三)
- android-用户界面[相对布局] 三
- 图形用户界面之窗口程序
- 微信小程序教程(三)
- 带你走进图形用户界面编制 (三)
- 第七讲:用户界面 View(三)
- Android 用户界面---菜单(Menus 三)
- Android 用户界面---状态栏通知(三)
- Android 用户界面---状态栏通知(三)
- Android 用户界面---菜单(Menus 三)
- web 测试 (三 )用户界面测试
- Android用户界面(三):线性布局…
- Android 用户界面---菜单(Menus 三)
- 用户界面(三)ImageView、ImageButton、Gallery
- 算法笔记(3) 学习技巧
- java标识符命名规则
- 通过远程jdbc方式连接到hive数据仓库
- 最长不下降子序列【ccf中学计算机程序设计 基础篇】
- 数据结构复习-插入排序
- 【微信小程序 三】用户界面
- 采用ubuntu系统来安装tensorflow
- 堆结构和堆排序的Java实现
- 把项目备份到GitHub已存在的仓库
- MySQL带IN关键字的子查询
- HDU2389_Rain on your Parade_二分图匹配::Hopcroft-Carp模板题
- MapReduce 只有Map阶段,写出到pc端
- 简述document.write和 innerHTML的区别。
- python爬取csdn的博客内容