<template>
    <div class='text-font-white w-11/12 mx-auto py-3 flex justify-between items-center '>
        <div class='left'>
            <div @click="goback()">
                <app-icon name='icon-fanhui' size='18px' color='#EEF1F6'></app-icon> 
            </div>
        </div>
        <div class='center'>{{title}}</div>
        <div class='right'>
            <!-- <div v-if="saveBtn.show" @click="clickSaveBtn" class="text-sm" :class="saveBtn.enable?' text-font-blue':' text-font-dark-blue'">
                保存
            </div> -->
            <div v-if="rightBtn" class="text-sm text-font-blue" @click="routerJump(rightBtn.path)">
                {{rightBtn.text}}
            </div>
        </div>
    </div>
</template>


<script lang="ts">
import Vue from 'vue';

export default Vue.extend({
    data() {
        return{
            saveBtn:{
                show:false,
                enable:false,
            },
        }
    },

  components:{
      'app-icon':()=>import('@/components/common/Icon.vue')
  },
  computed:{
      title():string{
          if(this.$route.query.text){
              return this.$route.query.text as string
          }else if(this.$route.query.type && this.$route.query.type == '封面图片'){
              return `上传${this.$route.query.type}`
          }else if(this.$route.query.type) {
              return '文件HASH计算'
          }else {
              return this.$route.meta?.title
          }
      },
      rightBtn(){
          return this.$route.meta?.rightBtn
      }
  },
  mounted(){
      if(this.$route.path.includes('/User/edit')){
            this.saveBtn.show = true
      }else{
           this.saveBtn.show = false
      } 
  },
    methods:{
        // clickSaveBtn(){
        //     if(this.saveBtn.enable){
        //         console.log(this.$route.params.type);
        //     }
        // },
        routerJump(path:string){
            this.$router.push(path)
        },
        goback(){
            if(this.$route.name == "NftTransfer"){
                // const nftId = this.$route.query.nftId
                // this.$router.push(`/Nft/${nftId}`)
                history.go(-1)
            }else {
                history.go(-1)
            }
        }
    }
});
</script>
