<template>
  <div class="header">
    {{ title }}
    <div class="right">
      <a href="javascript:;" @click="reloadPage">【刷新】</a>
      <a href="javascript:;" v-if="isShowPrevPage" @click="handlePrevPageClick">【返回上一页】</a>
    </div>
  </div>
</template>

<script>
export default {
    name: 'VHeader',
    inject: ['reload'],
    props: {
        isShowPrevPage: {
            type: Boolean,
            default: true
        },
        title: {
            type: String,
            default: '我是标题'
        }
    },
    methods: {
        reloadPage () {
            this.reload()
        },
        handlePrevPageClick () {
            this.$router.go(-1)
        }
    }
}
</script>

<style lang="stylus" scoped>
.header
	position relative
	padding 10px 15px
	font-size 18px
	border-bottom 1px solid #ddd
	.right
		position absolute
		top 0
		right 15px
		line-height 46px
		font-size 14px
		a
			color inherit
</style>
