<template>
	<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
  <view>
    <u-navbar
      :title="title"
      @leftClick="goBack"
      @rightClick="clickIcon"
      :autoBack="true"
      placeholder
	  bgColor="#FFF" 
	  leftIconColor="#000" 
      titleStyle="font-size: 32rpx;font-weight: 700;color:#000;"
    >
      <view slot="right">
        <span class="right-text">{{ text }}</span>
      </view>
    </u-navbar>
  </view>
</template>

<script>
	
export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    showBack: {
      type: Boolean,
      default: true
    },
    isBack: {
      type: Boolean,
      default: true
    },
    goTo: {
      type: String,
      default: ''
    },
	backGround: {
		type: Boolean,
		default: true
	},
    rightIcon: {
      type: String,
      default: 'plus'
    },
    showRightIcon: {
      type: Boolean,
      default: false
    },
    showRightText: {
      type: Boolean,
      default: false
    },
    text: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
		fontValue:uni.getStorageSync('fontSize') || 8,
	}
  },
  methods: {
    goBack() {
      if (this.isBack) {
        uni.navigateBack()
      } else {
        if (this.goTo) {
          uni.redirectTo({
            url: this.goTo
          })
        } else {
          uni.switchTab({
            url: '/pages/index'
          })
        }
      }
    },
    clickIcon() {
      this.$emit('clickIcon')
    }
  }
}
</script>

<style lang="scss" scoped>
.right-text {
  font-weight: 400;
  font-size: 24rpx;
  color: #1F72EA;
}
</style>
