index.vue 1001 Bytes
Newer Older
neogcg's avatar
neogcg committed
1
<template>
yanzhongrong's avatar
yanzhongrong committed
2 3 4 5 6 7
  <el-button
    :type="multipleSelection.length ? 'primary' : 'info'"
    :disabled="!multipleSelection.length"
    @click="del()"
    >删 除</el-button
  >
neogcg's avatar
neogcg committed
8 9
</template>
<script>
yanzhongrong's avatar
yanzhongrong committed
10
import { warningAlert } from "../../utils/alert";
neogcg's avatar
neogcg committed
11 12

export default {
yanzhongrong's avatar
yanzhongrong committed
13
  props: {
neogcg's avatar
neogcg committed
14 15
    multipleSelection2: {
      type: Array,
yanzhongrong's avatar
yanzhongrong committed
16
      default: () => []
neogcg's avatar
neogcg committed
17 18
    }
  },
yanzhongrong's avatar
yanzhongrong committed
19 20 21 22 23 24
  components: {},
  data() {
    return {
      multipleSelection: [],
    };
  },
neogcg's avatar
neogcg committed
25 26
  watch: {
    multipleSelection2: {
yanzhongrong's avatar
yanzhongrong committed
27
      immediate: true,
neogcg's avatar
neogcg committed
28 29
      handler(newV) {
        this.multipleSelection = !!newV
yanzhongrong's avatar
yanzhongrong committed
30
        this.multipleSelection = this.multipleSelection2
neogcg's avatar
neogcg committed
31 32 33
      },
    },
  },
yanzhongrong's avatar
yanzhongrong committed
34 35 36 37 38 39 40 41 42 43 44 45 46
  methods: {
    del() {
      this.$confirm('继续操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$emit("del")
      }).catch(() => {
        warningAlert("取消删除")
      });
    },
  },
neogcg's avatar
neogcg committed
47
};
yanzhongrong's avatar
yanzhongrong committed
48

neogcg's avatar
neogcg committed
49 50 51
</script>
<style scoped>
</style>