<template>
  <div class="batchButton">
    <div class="query-box" v-if="!checkButton.length">
      <el-input
        v-model="input"
        :placeholder="placeholder"
        @keyup.enter.native="filtrate"
      />
      <el-button type="primary" @click.native.prevent="filtrate" 
        >搜索</el-button
      >
    </div>
    <div class="button-box" v-else>
      <curren-Button
        :Butttondata="Butttondata"
        @tableButtonClick="tableButtonClick"
      ></curren-Button>
    </div>
  </div>
</template>
<script>
import currenButton from "@/components/currenButton"
export default {
  name: 'batchButton',
  components: {
    currenButton,
  },
  props: {
    Butttondata: {
      type: Array,
      default: () => {
        return []
      }
    },
    placeholder: {
      type: String,
      default: '搜索...'
    },
    checkButton: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  computed: {

  },
  data () {
    return {
      input: ''
    }
  },
  methods: {
    //搜索字段变化时
    filtrate () {
      this.$emit('filtrate', this.input)
    },
    tableButtonClick (val) {
      this.$emit('tableButtonClick', val)
    }
  }
}
</script>
<style lang="scss" scoped>
.batchButton {
  display: flex;
  align-items: center;
  height: 50px;
  .query-box {
    display: flex;
    .el-button {
      margin: 0 0 0 10px;
    }
  }
}
</style>