This repository was archived by the owner on Mar 14, 2025. It is now read-only.
File tree 1 file changed +25
-3
lines changed
1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -27,26 +27,48 @@ npm install vue-toast-notification@^3.0
27
27
28
28
## Usage
29
29
30
+ ### Plugin usage
31
+
30
32
``` js
31
33
import {createApp } from ' vue' ;
32
- import VueToast from ' vue-toast-notification' ;
34
+ import ToastPlugin from ' vue-toast-notification' ;
33
35
// Import one of the available themes
34
36
// import 'vue-toast-notification/dist/theme-default.css';
35
37
import ' vue-toast-notification/dist/theme-sugar.css' ;
36
38
37
39
const app = createApp ({});
38
- app .use (VueToast );
40
+ app .use (ToastPlugin );
39
41
app .mount (' #app' );
40
42
41
- // Vue.$toast.open({/* options */});
42
43
let instance = app .$toast .open (' You did it!' );
43
44
44
45
// Force dismiss specific toast
45
46
instance .dismiss ();
47
+
46
48
// Dismiss all opened toast immediately
47
49
app .$toast .clear ();
48
50
```
49
51
52
+ ### Composition API usage
53
+
54
+ ``` js
55
+ import {createApp } from ' vue' ;
56
+ import {useToast } from ' vue-toast-notification' ;
57
+ import ' vue-toast-notification/dist/theme-sugar.css' ;
58
+
59
+ const app = createApp ({});
60
+ app .mount (' #app' );
61
+
62
+ const $toast = useToast ();
63
+ let instance = $toast .success (' You did it!' );
64
+
65
+ // Force dismiss specific toast
66
+ instance .dismiss ();
67
+
68
+ // Dismiss all opened toast immediately
69
+ $toast .clear ();
70
+ ```
71
+
50
72
## Available options
51
73
52
74
The API methods accepts these options:
You can’t perform that action at this time.
0 commit comments