当前位置:   article > 正文

微信小程序,配置tabBar_小程序 有 tabbar 第一个显示页面

小程序 有 tabbar 第一个显示页面
{
	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
		{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "香喷喷"
			}
		},
		{
			"path": "pages/like/like",
			"style": {
				"navigationBarTitleText": "香喷喷"
			}
		}
	],
	"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "11",
		"navigationBarBackgroundColor": "#F8F8F8",
		"backgroundColor": "#F8F8F8"
	},
	 "tabBar": {
	    "color": "#666666",
	    "selectedColor": "#ff4a4a",
	    "borderStyle": "white",
	    "backgroundColor": "#ffffff",
	    "list": [{
	      "pagePath": "pages/index/index",
	      "text": "首页",
	      "iconPath": "./static/footer1.png",
	      "selectedIconPath": "./static/footer1-sel.png"
	    },{
	      "pagePath": "pages/like/like",
	      "text": "粉丝",
		   "iconPath": "./static/footer2.png",
		   "selectedIconPath": "./static/footer2-sel.png"
	    }]
	  }
		
	======================================
	"tabBar": {
	    "color": "#7A7E83",	//默认文字颜色
	    "selectedColor": "#3cc51f",	//选择后的文字颜色
	    "borderStyle": "black",		//边框颜色
	    "backgroundColor": "#ffffff",	//导航背景颜色
	    "list": [{
	        "pagePath": "pages/index/index",	//要跳转的路径
	        "iconPath": "./static/footer1.png",	//默认图标
	        "selectedIconPath": "./static/footer1-sel.png",	//激活图标样式
	        "text": "首页"		//要显示的文字
	    },
========================================================
"pages": [ 
		{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "我的"	//设置title的名字,有点鸡肋
			}
		}
		]
  
}
=================获取code 进行用户信息获取存入本地======================
wx.login({
				      success: function (res) {
					    uni.setStorageSync('wxcode', res.code); //存入本地
					   uni.request({
					       url: wxurl+'/login/getOpenid', //仅为示例,并非真实接口地址。
					       data: {
					          code:res.code	//利用code发送请求获取微信用户信息
					       },
						   method:"POST",
					       header: {
					           'custom-header': 'hello' //自定义请求头信息
					       },
					       success: (res) => {
					           console.log(res);
					       }
					   });
					   
					   }
				    })
==================页面跳转 然后在登录页面判断本地是否存在code 如果存在就直接到主页
uni.switchTab({
			  url: '/pages/index/index'
		     });		
             
在跳转页判断本地有没有code
=========横向拉滚动==================
<scroll-view class="box" scroll-x="true">
				<view class="box-item">
						//这里写内容
				</view>
			</scroll-view>
			
			.box {
		width: 100vw;
		height: 400rpx;
		white-space: nowrap;
		box-sizing: border-box
	}


	.box-item {
	   width: 45%;
	   margin: 20px 18px 0;
	    box-sizing: border-box;
	    display: inline-block;
	}


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/576846
推荐阅读
相关标签
  

闽ICP备14008679号