Corrected Modal()
This commit is contained in:
@@ -398,14 +398,14 @@ export const Menu = (p) => {
|
||||
each(() => val(items) || [], render)
|
||||
)
|
||||
};
|
||||
export const Modal = (p) => {
|
||||
export const Modal = (p, c) => {
|
||||
let dialogRef = null;
|
||||
watch(() => { const isOpen = val(p.open); if (!dialogRef) return; isOpen ? dialogRef.showModal() : dialogRef.hide(); });
|
||||
watch(() => { const isOpen = val(p.open); if (!dialogRef) return; isOpen ? dialogRef.showModal() : dialogRef.close(); });
|
||||
const close = () => isFunc(p.open) && p.open(false);
|
||||
return h("dialog", { ...p, ref: el => dialogRef = el, class: cls('modal', p.class), onclose: close, oncancel: close }, [
|
||||
h("div", { class: "modal-box" }, [
|
||||
p.title && h("h3", { class: "text-lg font-bold" }, p.title),
|
||||
p.children,
|
||||
c,
|
||||
h("div", { class: "modal-action" }, [
|
||||
p.actions || Button({ class: 'btn', onclick: close }, 'Cerrar')
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user