Using mini buttons for edit/delete

parent 3a7edb0d
<template> <template>
<el-button type="danger" @click="deleteRow" size="small"><i class="fa fa-trash"></i></el-button> <el-button type="danger" @click="deleteRow" size="mini"><i class="fa fa-trash"></i></el-button>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
rows: {default: null}, rows: { default: null },
scope: {default: null}, scope: { default: null },
}, },
data() { data() {
return { return {
deleteMessage: '', deleteMessage: '',
deleteTitle: '', deleteTitle: '',
} };
}, },
methods: { methods: {
deleteRow(event) { deleteRow(event) {
...@@ -22,35 +22,35 @@ ...@@ -22,35 +22,35 @@
type: 'warning', type: 'warning',
confirmButtonClass: 'el-button--danger', confirmButtonClass: 'el-button--danger',
}).then(() => { }).then(() => {
let vm = this; const vm = this;
axios.delete(this.scope.row.urls.delete_url) axios.delete(this.scope.row.urls.delete_url)
.then(response => { .then((response) => {
if (response.data.errors === false) { if (response.data.errors === false) {
vm.$message({ vm.$message({
type: 'success', type: 'success',
message: response.data.message message: response.data.message,
}); });
vm.rows.splice(vm.scope.$index, 1); vm.rows.splice(vm.scope.$index, 1);
} }
}) })
.catch(error => { .catch((error) => {
vm.$message({ vm.$message({
type: 'error', type: 'error',
message: error.data.message message: error.data.message,
}); });
}); });
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: this.trans('core.delete cancelled') message: this.trans('core.delete cancelled'),
}); });
}); });
} },
}, },
mounted() { mounted() {
this.deleteMessage = this.trans('core.modal.confirmation-message'); this.deleteMessage = this.trans('core.modal.confirmation-message');
this.deleteTitle = this.trans('core.modal.title'); this.deleteTitle = this.trans('core.modal.title');
} },
} };
</script> </script>
<template> <template>
<el-button <el-button
size="small" size="mini"
@click.prevent="goToEditPage()"> @click.prevent="goToEditPage()">
<i class="fa fa-pencil"></i> <i class="fa fa-pencil"></i>
</el-button> </el-button>
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
<script> <script>
export default { export default {
props: { props: {
to: {type: Object, required: true} to: { type: Object, required: true },
}, },
methods: { methods: {
goToEditPage() { goToEditPage() {
this.$router.push(this.to); this.$router.push(this.to);
}, },
}, },
} };
</script> </script>
...@@ -117157,7 +117157,7 @@ var render = function() { ...@@ -117157,7 +117157,7 @@ var render = function() {
var _c = _vm._self._c || _h var _c = _vm._self._c || _h
return _c( return _c(
"el-button", "el-button",
{ attrs: { type: "danger", size: "small" }, on: { click: _vm.deleteRow } }, { attrs: { type: "danger", size: "mini" }, on: { click: _vm.deleteRow } },
[_c("i", { staticClass: "fa fa-trash" })] [_c("i", { staticClass: "fa fa-trash" })]
) )
} }
...@@ -117260,7 +117260,7 @@ var render = function() { ...@@ -117260,7 +117260,7 @@ var render = function() {
return _c( return _c(
"el-button", "el-button",
{ {
attrs: { size: "small" }, attrs: { size: "mini" },
on: { on: {
click: function($event) { click: function($event) {
$event.preventDefault() $event.preventDefault()
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