|
1 | 1 | <template> |
2 | | - <toast-layout-alternate |
3 | | - v-if="layout === 'alternate'" |
| 2 | + <component |
| 3 | + :is="selectedLayout" |
4 | 4 | :is-shown="isShown" |
5 | 5 | :title-id="titleId" |
6 | 6 | :content-id="contentId" |
|
33 | 33 | <template #action> |
34 | 34 | <slot name="action" /> |
35 | 35 | </template> |
36 | | - </toast-layout-alternate> |
37 | | - <toast-layout-default |
38 | | - v-else |
39 | | - :is-shown="isShown" |
40 | | - :title-id="titleId" |
41 | | - :content-id="contentId" |
42 | | - :title="title" |
43 | | - :message="message" |
44 | | - :role="role" |
45 | | - :kind="kind" |
46 | | - :important="important" |
47 | | - :close-button-props="closeButtonProps" |
48 | | - :hide-close="hideClose" |
49 | | - :hide-icon="hideIcon" |
50 | | - :hide-action="hideAction" |
51 | | - v-on="$listeners" |
52 | | - @close="handleClose" |
53 | | - > |
54 | | - <!-- @slot Slot for custom icon --> |
55 | | - <template #icon> |
56 | | - <slot name="icon" /> |
57 | | - </template> |
58 | | - <template #titleOverride> |
59 | | - <!-- @slot Allows you to override the title, only use this if you need to override |
60 | | - with something other than text. Otherwise use the "title" prop. --> |
61 | | - <slot name="titleOverride" /> |
62 | | - </template> |
63 | | - <!-- @slot the main textual content of the toast --> |
64 | | - <slot> |
65 | | - {{ message }} |
66 | | - </slot> |
67 | | - <!-- @slot Enter a possible action for the user to take, such as a link to another page --> |
68 | | - <template #action> |
69 | | - <slot name="action" /> |
70 | | - </template> |
71 | | - </toast-layout-default> |
| 36 | + </component> |
72 | 37 | </template> |
73 | 38 |
|
74 | 39 | <script> |
@@ -216,9 +181,7 @@ export default { |
216 | 181 | }, |
217 | 182 |
|
218 | 183 | /** |
219 | | - * The duration in ms the toast will display before disappearing. |
220 | | - * The toast won't disappear if the duration is not provided. |
221 | | - * If it's provided, it should be equal to or greater than 6000. |
| 184 | + * The layout / styling you wish to use for the toast. |
222 | 185 | * @values default, alternate |
223 | 186 | */ |
224 | 187 | layout: { |
@@ -257,6 +220,10 @@ export default { |
257 | 220 | shouldSetTimeout () { |
258 | 221 | return !!this.duration && this.duration >= this.minDuration; |
259 | 222 | }, |
| 223 | +
|
| 224 | + selectedLayout () { |
| 225 | + return this.layout === 'alternate' ? ToastLayoutAlternate : ToastLayoutDefault; |
| 226 | + }, |
260 | 227 | }, |
261 | 228 |
|
262 | 229 | watch: { |
|
0 commit comments