<!--
 * @Title: 
 * @Description: 
 * @version: 
 * @Author: wzs
 * @Date: 2022-12-07 14:21:35
 * @LastEditors: wzs
 * @LastEditTime: 2023-01-15 20:43:45
-->
<template>
  <div>
    <el-input placeholder="请输入内容" :value="value" @input="onInput" @keyup.enter.native="onConfirm" clearable>
      <i slot="prefix" class="el-input__icon el-icon-search"></i>
    </el-input>
    <div class="kt-canvas-table-select-footer">
      <!-- <el-button type="text" @click="$emit('cancel')">取 消</el-button> -->
      <el-button type="text" @click="onReset">重 置</el-button>
      <el-button type="primary" size="mini" @click="onConfirm" >确 认</el-button>
    </div>
  </div>
</template>
<script>
import { isNull } from '../utils';
export default {
  props: {
    value: String
  },
  data() {
    return {
      currentValue: ''
    };
  },
  watch: {
    value(val) {
      this.currentValue = val;
    }
  },
  computed: {
    disabledReset() {
      return isNull(this.currentValue);
    }
  },
  methods: {
    onInput(val) {
      this.currentValue = val;
      this.$emit('input', val);
    },
    onConfirm() {
      this.$emit('confirm', this.currentValue);
    },
    onReset() {
      // console.log('reset');
      this.$emit('input', '');
      this.$emit('confirm', '');
    }
  }
};
</script>