/**
 * 自定义导航栏的骨架页面的属性配置
 */
const navBarPageMixin = {
	props: {
		leftIcon: {
			type: String,
			default: ''
		},
		leftText: {
			type: String,
			default: ""
		},
		rightText: {
			type: String,
			default: ''
		},
		rightTextColor: {
			type: String,
			default: '#5FC48D'
		},
		backgroundColor: {
			type: String,
			default: "#FFFFFF"
		},
		title: {
			type: String,
			default: ''
		},
		// 标题字体颜色
		color: {
			type: String,
			default: "#fff"
		},
		fixed: {
			type: Boolean,
			default: true
		},
		clickLeftFn: {
			type: [Boolean, Function],
			default: false
		},
		clickRightFn: {
			type: [Boolean, Function],
			default: false
		},
		// 右侧是否需要显示
		rightShow: {
			type: [String, Boolean],
			default: true
		},
		// BottomNavBar配置
		curKey: {
			type: String,
			default: 'mall'
		},
		// 是否需要增加平台状态栏高度
		platformsHeight: {
			type: [Boolean, String],
			default: true
		},
		// 左侧icon的颜色配置
		leftIconColor: {
			type: String,
			default: ""
		}
	},
	methods: {
		clickLeft () {
			!this.clickLeftFn ? this.back() : this.clickLeftFn()
		},
		clickRight () {
			this.clickRightFn && this.clickRightFn()
		},
		back(){
			let pages = getCurrentPages()
			if(pages.length == 1){
				uni.reLaunch({
					url:'/pages/home/index'
				})
			}else{
				uni.navigateBack()
			}
		}
	}
}

export default navBarPageMixin;
