| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 | 
							- <template>
 
- 	<view class="tab_bar">
 
- 		<view class="tabbarBox">
 
- 			<view class="handleBox" v-for="(item,index) in tabBarList" :key="index">
 
- 				<view class="menuBox" @click="goPages(item.pageIndex)">
 
- 					<view class="menuIcon">
 
- 						<image v-if="item.indexName!=selectIndex" class="img" :src="item.iconPath"></image>
 
- 						<image v-else class="img" :src="item.selectIconPath"></image>
 
- 					</view>
 
- 					<view class="menuName">
 
- 						<text class="Text">{{item.tabbarName}}</text>
 
- 					</view>
 
- 				</view>
 
- 			</view>
 
- 		</view>
 
- 	</view>
 
- </template>
 
- <script>
 
- 	export default {
 
- 		props: {
 
- 			page: {
 
- 				type: String,
 
- 				default: "homeIndex"
 
- 			}
 
- 		},
 
- 		watch: {
 
- 			page: {
 
- 				handler(value) {
 
- 					this.selectIndex = value;
 
- 				},
 
- 				immediate: true,
 
- 				deep: true
 
- 			}
 
- 		},
 
- 		data() {
 
- 			return {
 
- 				selectIndex: "",
 
- 				tabBarList: [{
 
- 						"flag": 'icon',
 
- 						"pageIndex": "pages/tabbar/homePage",
 
- 						"iconPath": "/static/menu_imgs/home.png",
 
- 						"selectIconPath": "/static/menu_imgs/home-default.png",
 
- 						"tabbarName": "首页"
 
- 					},
 
- 					{
 
- 						"flag": 'icon',
 
- 						"pageIndex": "pages/tabbar/workBranch",
 
- 						"iconPath": "/static/menu_imgs/home.png",
 
- 						"selectIconPath": "/static/menu_imgs/home-default.png",
 
- 						"tabbarName": "工作台"
 
- 					},
 
- 					{
 
- 						"flag": 'icon',
 
- 						"pageIndex": "pages/tabbar/personCenter",
 
- 						"iconPath": "/static/menu_imgs/home.png",
 
- 						"selectIconPath": "/static/menu_imgs/home-default.png",
 
- 						"tabbarName": "个人中心"
 
- 					}
 
- 				]
 
- 			}
 
- 		},
 
- 		//uniapp子组件不支持应用生命周期,所以只能用vue生命周期
 
- 		mounted() {
 
- 		},
 
- 		methods: {
 
- 			//进入tabble页
 
- 			goPages(pageIndex) {
 
- 				uni.switchTab({
 
- 					url: pageIndex
 
- 				})
 
- 			},
 
- 		},
 
- 	}
 
- </script>
 
- <style lang="scss">
 
- 	.tab_bar {
 
- 		width: 100vw;
 
- 		height: 150rpx;
 
- 		position: fixed;
 
- 		bottom: 0rpx;
 
- 		background: #ffffff;
 
- 		.tabbarBox {
 
- 			display: flex;
 
- 			margin-top: 5rpx;
 
- 			justify-content: space-evenly;
 
- 			.handleBox {
 
- 				width: 20vw;
 
- 				height: 120rpx;
 
- 				.menuBox {
 
- 					padding: 0rpx 20rpx;
 
- 					width: 120rpx;
 
- 					height: 98%;
 
- 					text-align: center;
 
- 					.img {
 
- 						width: 50rpx;
 
- 						height: 50rpx;
 
- 					}
 
- 				}
 
- 			}
 
- 		}
 
- 	}
 
- 	.Text {
 
- 		font-size: 25rpx;
 
- 	}
 
- </style>
 
 
  |