diff --git a/src/runtime/components/Toaster.vue b/src/runtime/components/Toaster.vue index 349c86bf..b6af5d84 100644 --- a/src/runtime/components/Toaster.vue +++ b/src/runtime/components/Toaster.vue @@ -19,6 +19,11 @@ export interface ToasterProps extends Omit * @defaultValue true */ expand?: boolean + /** + * Render the toaster in a portal. + * @defaultValue true + */ + portal?: boolean class?: any ui?: Partial } @@ -44,6 +49,7 @@ import UToast from './Toast.vue' const props = withDefaults(defineProps(), { expand: true, + portal: true, duration: 5000 }) defineSlots() @@ -120,18 +126,20 @@ function getOffset(index: number) { @click="toast.click && toast.click(toast)" /> - + + + diff --git a/test/components/Toast.spec.ts b/test/components/Toast.spec.ts index 100ae54a..c07db3cd 100644 --- a/test/components/Toast.spec.ts +++ b/test/components/Toast.spec.ts @@ -12,7 +12,7 @@ const ToastWrapper = defineComponent({ ClientOnly }, inheritAttrs: false, - template: ` + template: `