wwf
昨天 34f5733bc1f126c572580fa849b9403dfcddd84b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<template>
  <el-row style="width: 100%;flex-wrap: nowrap;">
    <div style="flex-grow: 0;">
      <el-tooltip content="刷新列表数据" placement="top-start">
        <el-button type="text" style="width: 30px;" :loading="loadingFlag" @click.stop="handlerRefresh()" class="mr-2">
          <Icon v-show="!loadingFlag" icon="material-symbols:refresh-rounded" width="26" height="26" style="color: #4d4d4d" />
          <template #loading>
            <Icon icon="line-md:loading-loop" width="30" height="30" style="color: black" />
          </template>
        </el-button>
      </el-tooltip>
    </div>
    <slot name="default"></slot>
  </el-row>
</template>
 
<script>
import { debounce } from '@/utils/tool.js'
export default {
  data() {
    return {
      loading: false
    }
  },
  props: {
    loadingFlag: {
      type: Boolean,
      default: false
    },
    refresh: {
      type: Function,
      default: () => {}
    },
    filter: {
      type: Object,
      default: () => { 
        return {} 
      }
    }
  },
  watch: {
    filter: {
      handler: debounce(function() {
        this.handlerRefresh()
      }, 1000),
      deep: true
    }
  },
  methods: { 
    handlerRefresh() {
      this.refresh()
    }
  }
}
</script>