<template>
  <div class="page-wrap" v-if="total/pageSize>1">
    <el-pagination
      :current-page.sync="current"
      :page-size="pageSize"
      layout="prev, pager, next"
      :total="total"
      @current-change="handleCurrentChange"
      v-if="total/pageSize>=1">
    </el-pagination>
    <ul class="pagination" style="float:right;margin-left:20px;">
        <li>
          <input type="text" class="page-number" v-model="nowPage">
        </li>
        <li>
          <a class="page-a" @click="changePage">GO</a>
        </li>
    </ul>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        nowPage: this.current
      }
    },
    watch: {
      current: function () {
        this.nowPage = this.current
      }
    },
    props: ['current', 'total', 'pageSize'],
    methods: {
      handleCurrentChange: function (changedPage) {
        this.$emit('childEvent', changedPage)
      },
      changePage: function () {
        this.$emit('childEvent', this.nowPage)
      }
    }
  }
</script>

<style>
  a {
    color: #2d8cf0;
    background: 0 0;
    text-decoration: none;
    outline: 0;
    cursor: pointer;
    transition: color .2s ease;
  }
  .el-pagination .btn-next, .el-pagination .btn-prev {
    color: #337ab7;
  }
  .el-pager li{
    color: #337ab7;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #ddd;
    font-size: 10px;
  }
  .el-pager li:not(.active):hover, .el-pagination button:hover {
    z-index: 3;
    color: #23527c;
    background-color: #eee;
    border-color: #ddd;
  }
  .el-pager li.active {
    background: #5078cb!important;
  }
  .el-icon-arrow-left:before {
    content: "\f100";
    font-family: FontAwesome;
  }
  .el-icon-arrow-right:before {
    content: "\f101";
    font-family: FontAwesome;
  }
  .el-pagination button.disabled {
    color: #337ab7;
    background-color: #fff;
    cursor: not-allowed;
  }
  .pagination {
    display: inline-block;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
  }
  .pagination>li {
    display: inline;
  }
  input.page-number {
    vertical-align: inherit;
    display: inline-block;
    width: 40px;
    height: 31px;
    padding: 6px 6px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #9B9792;
    text-align: center;
    background-color: #F6F5F4;
    background-image: none;
    border: 1px solid #ccc;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
  }
  .page-a {
    background: #5078cb !important;
    color: #fff !important;
    float: right!important;
  }
  .page-a {
    color: #fff;
    border-color: #4574e8;
    padding: 6px 6px!important;
    font-size: 14px!important;
    border-top-right-radius: 4px!important;
    border-bottom-right-radius: 4px!important;
    text-decoration: none;
    height: 31px;
  }
  .page-wrap{
    float: right;
    margin: 30px 0;
  }
  .page-wrap ul, .page-wrap div {
    display: inline-block;
    margin: 0;
  }
</style>
