Commit 8572cbe7 authored by neogcg's avatar neogcg

3/4

parent c645b2bc
<template> <template>
<el-button
<el-button :type="multipleSelection.data.length ? 'primary' : 'info'" :type="multipleSelection.data.length ? 'primary' : 'info'"
:disabled="!multipleSelection.data.length" @click="del()">删 除</el-button> :disabled="!multipleSelection.data.length"
@click="del()"
>删 除</el-button
>
</template> </template>
<script> <script>
import {mapGetters,mapActions} from 'vuex'; import { mapGetters, mapActions } from "vuex";
import { warningAlert } from "../../utils/alert"; import { warningAlert } from "../../utils/alert";
export default { export default {
props: { props: {
multipleSelection2: { multipleSelection2: {
type: Array, type: Array,
default: () => {} default: () => {},
} },
},
components: {},
data() {
return {
multipleSelection: formInit(),
};
}, },
components: {},
data() {
return {
multipleSelection:formInit(),
};
},
watch: { watch: {
multipleSelection2: { multipleSelection2: {
immediate: true, immediate: true,
handler(newV) { handler(newV) {
this.multipleSelection = !!newV this.multipleSelection = !!newV;
this.multipleSelection = formInit(this.multipleSelection2) this.multipleSelection = formInit(this.multipleSelection2);
}, },
}, },
}, },
computed: { computed: {
...mapGetters({}), ...mapGetters({}),
}, },
methods: { methods: {
...mapActions({}), ...mapActions({}),
del(){ del() {
this.$confirm('继续操作将永久删除, 是否继续?', '提示', { this.$confirm("继续操作将永久删除, 是否继续?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { })
this.$emit("del") .then(() => {
}).catch(() => { this.$emit("del");
warningAlert("取消删除") })
.catch(() => {
warningAlert("取消删除");
}); });
}, },
}, },
mounted() {}, mounted() {},
}; };
function formInit(data = []) { function formInit(data = []) {
return { return {
data,
data };
}
} }
</script> </script>
<style scoped> <style scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment