Skip to content

Commit f49445d

Browse files
committed
fix(CToast): custom variant validator issue
1 parent c420063 commit f49445d

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

src/components/toast/CToast.ts

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, h, provide, ref, RendererElement, Transition } from 'vue'
1+
import { defineComponent, h, onMounted, provide, ref, RendererElement, Transition } from 'vue'
22

33
import { Color } from '../props'
44

@@ -42,13 +42,15 @@ const CToast = defineComponent({
4242
},
4343
key: {
4444
type: Number,
45+
default: undefined,
4546
required: false,
4647
},
4748
/**
4849
* Title node for your component.
4950
*/
5051
title: {
5152
type: String,
53+
default: undefined,
5254
required: false,
5355
},
5456
/**
@@ -103,16 +105,14 @@ const CToast = defineComponent({
103105
}
104106
}
105107

106-
;(() => {
108+
onMounted(() => {
107109
if (props.autohide) {
108110
clearTimeout(timeout)
109111
timeout = window.setTimeout(() => {
110112
visible.value = false
111113
}, props.delay)
112114
}
113-
})()
114-
115-
// autohide()
115+
})
116116

117117
return () =>
118118
h(
@@ -124,25 +124,24 @@ const CToast = defineComponent({
124124
onLeave: (el, done) => handleLeave(el, done),
125125
onAfterLeave: (el) => handleAfterLeave(el),
126126
},
127-
[
127+
() =>
128128
visible.value &&
129-
h(
130-
'div',
131-
{
132-
class: [
133-
'toast fade',
134-
{
135-
[`bg-${props.color}`]: props.color,
136-
},
137-
],
138-
'aria-live': 'assertive',
139-
'aria-atomic': true,
140-
role: 'alert',
141-
ref: 'toastRef',
142-
},
143-
slots.default && slots.default(),
144-
),
145-
],
129+
h(
130+
'div',
131+
{
132+
class: [
133+
'toast fade',
134+
{
135+
[`bg-${props.color}`]: props.color,
136+
},
137+
],
138+
'aria-live': 'assertive',
139+
'aria-atomic': true,
140+
role: 'alert',
141+
ref: 'toastRef',
142+
},
143+
slots.default && slots.default(),
144+
),
146145
)
147146
},
148147
})

0 commit comments

Comments
 (0)