emit
This commit is contained in:
parent
13b5589083
commit
c76af202de
2 changed files with 19 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ import type { QTableProps } from "quasar";
|
|||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm } = mixin;
|
||||
const { dialogConfirm, dialogMessageNotify } = mixin;
|
||||
|
||||
interface typeOp {
|
||||
id: string;
|
||||
|
|
@ -127,6 +127,9 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
/**ส่งค่ากลับหน้าหลัก */
|
||||
const emit = defineEmits(["returnData"]);
|
||||
|
||||
/** ปิด dialog */
|
||||
async function close() {
|
||||
console.log("close");
|
||||
|
|
@ -135,13 +138,17 @@ async function close() {
|
|||
|
||||
/** เปิด dialog ยืนยัน */
|
||||
function savePost() {
|
||||
dialogConfirm($q, () => saveData());
|
||||
if (selected.value.length != 0) {
|
||||
dialogConfirm($q, () => saveData());
|
||||
} else {
|
||||
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 รายการ");
|
||||
}
|
||||
}
|
||||
|
||||
/** save data หลังจาก ยืนยัน */
|
||||
function saveData() {
|
||||
console.log("save #in component", selected.value);
|
||||
props.save();
|
||||
emit("returnData", selected.value);
|
||||
}
|
||||
|
||||
/** input ค้นหา */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue