&_创建一个包含:首页和个人中心页2个标签的小程序,每个标签都有对应的页面、图">
赞
踩
pages/index/index
<view class="home">
<text class="welcome">我的主页</text>
<image src="/images/avatar.png" mode="aspectFill" bindtap="changeImage"></image>
</view>
<view class="content">
<view>昵称:5秒钟的记忆</view>
<view>星座:天平座</view>
<view>兴趣:看书、旅游</view>
<view>QQ:123456789</view>
<view>电话:123456789</view>
</view>
.home{ display: flex; flex-direction: column; align-items: center; } .welcome{ font-size: 50rpx; color: orange; margin: 40rpx 0; } .home>image{ width: 300rpx; height: 300rpx; border-radius: 50%; border-color: maroon; border-style: solid; } .content{ font-size: 32rpx; width: 400rpx; margin: 50rpx auto; } .content>view{ text-align: center; padding: 10rpx 0; color: orange; }
Page({ changeImage:function(e){ //第1中方式,只能跳转tabBar页面 wx.switchTab({ url: '/pages/person/person', }) //第2种方式,可以跳转tabBar或者非tabBar页面 // wx.reLaunch({ // url: '/pages/person/person', // }) //第3中navigateTo,只能跳转非标签页,可以返回上个页面 // wx.navigateTo({ // url: '/pages/person/person', // }) //第4中,redirectTo,非标签页,关闭当前页面 // wx.redirectTo({ // url: '/pages/person/person', // }) } })
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。