<template>
	<view class="back" :style="'height:'+capsuleHeight+ 'px;top:'+capsuleHighly+'px;'">
		<!-- <view class="t-icon t-icon-fanhui2-copy" @click="backIconHandler"></view> -->
		<u-icon name="arrow-left" color="#000000" size="18" @click="backIconHandler"></u-icon>
		<view class="back-text">
			{{ text }}
		</view>
	</view>
</template>

<script>
	export default {
		name: "back",
		props:{
			text:{
				type:String,
				default:''
			}
		},
		data() {
			return {
				//胶囊高度
				capsuleHeight: 0,
				//
				capsuleHighly: 0,
			};
		},
		created() {
			this.getCapsuleSite()
		},
		methods:{
			backIconHandler(){
				//调用自定义事件
				// this.$emit('click')
				uni.navigateBack()
			},
			//获取胶囊位置信息
			getCapsuleSite(){
				let res=uni.getMenuButtonBoundingClientRect()
				console.log(res)
				this.capsuleHeight = res.height
				this.capsuleHighly = res.top 
			}
		}
	}
</script>

<style lang="scss">
	.back {
		position: relative;
		padding: 0 0 120rpx 20rpx;
		display: flex;
		align-items: center;
		z-index: 99;

		.t-icon {
			width: 45rpx;
			height: 45rpx;
		}
		
		.back-text{
			font-size: 40rpx;
			margin-left: 20rpx;
		}
	}
</style>
