<template>
  <mt-header fixed :title="title">
    <mt-button icon="back" @click="back" slot="left"></mt-button>
    <router-link :to="buttonUrl"  v-if="buttonText" slot="right">
      <mt-button class="sub-button">{{buttonText}}</mt-button>
    </router-link>
  </mt-header>
</template>

<script>
		import { MessageBox } from 'mint-ui'
    export default {
      name: "Back",
      props:['title', 'buttonText', 'buttonUrl'],
      methods:{
        back(){
					if(this.title == '模拟考试'){
						MessageBox.confirm('确定退出模拟考试吗?').then(action => {
							this.$router.go(-1)
						}, () => {});
					}else{
						this.$router.go(-1)
					}
        }
      },
    }
</script>

<style scoped>
  .mint-header.is-fixed{
    color: #000;
    height: 5rem;
    font-size: 1.88rem;
    font-family:MicrosoftYaHei;
    font-weight:400;
    background: #fff;
  }
  .sub-button{
    font-size:1.56rem;
    font-family:MicrosoftYaHei;
    font-weight:400;
    color:rgba(0,131,255,1);
  }

</style>
