TopBar.vue 723 Bytes
Newer Older
王建威's avatar
王建威 committed
1 2
<template>
	<view class="topbar_view">
王建威's avatar
王建威 committed
3
		<text class="eosfont left_icon" @click="back()">&#xe622;</text>
王建威's avatar
王建威 committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17
		{{this.title}}
	</view>
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				default: ''
			}
		},
		methods: {
			back() {
18 19 20 21 22 23
				const routes = getCurrentPages();
				if(routes.length > 1){
					uni.navigateBack();
				}else{
					history.back();
				}
王建威's avatar
王建威 committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
			}
		}
	}
</script>

<style lang="less" scoped>
	.topbar_view {
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		color: #212121;
		font-size: 30rpx;
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		background-color: #fff;
王建威's avatar
王建威 committed
41
		z-index: 100;
王建威's avatar
王建威 committed
42 43 44 45 46 47
		.left_icon {
			position: absolute;
			left: 20rpx;
		}
	}
</style>