29 lines
707 B
Vue
29 lines
707 B
Vue
<script lang="ts">
|
|
import { defineComponent, h, inject, useAttrs } from "vue";
|
|
import CloseButton from "../close-button/CloseButton.vue";
|
|
import { toastContextKey } from "./context";
|
|
|
|
export default defineComponent({
|
|
name: "ToastCloseButton",
|
|
inheritAttrs: false,
|
|
props: {
|
|
isDisabled: { type: Boolean, default: false },
|
|
},
|
|
setup(props, { slots }) {
|
|
const attrs = useAttrs();
|
|
const ctx = inject(toastContextKey, null);
|
|
return () =>
|
|
h(
|
|
CloseButton,
|
|
{
|
|
...attrs,
|
|
isDisabled: props.isDisabled,
|
|
class: [ctx?.slots.value.close(), attrs.class],
|
|
"data-slot": "toast-close",
|
|
},
|
|
slots,
|
|
);
|
|
},
|
|
});
|
|
</script>
|