index.vue 909 Bytes
<template>
	<u-navbar safeAreaInsetTop :leftIconColor="leftIconColor" :leftIcon="canBack ? 'arrow-left' : ''" placeholder
		@leftClick="handleBack()" color="#fff" :bgColor="bgColor">
		<view class="flex justify-center align-center text-lg" :style="{color:textColor}" slot="center">
			{{title}}
		</view>
	</u-navbar>
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				default: ''
			},
			canBack: {
				type: Boolean,
				default: false
			},
			bgColor: {
				type: String,
				default: '#fff'
			},
			leftIconColor: {
				type: String,
				default: '#303133'
			},
			textColor:{
				type: String,
				default: '#303133'
			}
		},
		mounted() {
			// console.log('canBack', this.canBack)
		},
		methods: {
			handleBack() {
				if (!this.canBack) {
					return
				}
				console.log('返回')
				this.$goBack()
			}
		}
	}
</script>

<style scoped lang="scss">
</style>