Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 4a3fae8

Browse files
doc: Update readme usage section. (#75)
1 parent a4b759e commit 4a3fae8

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

readme.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,48 @@ npm install vue-toast-notification@^3.0
2727

2828
## Usage
2929

30+
### Plugin usage
31+
3032
```js
3133
import {createApp} from 'vue';
32-
import VueToast from 'vue-toast-notification';
34+
import ToastPlugin from 'vue-toast-notification';
3335
// Import one of the available themes
3436
//import 'vue-toast-notification/dist/theme-default.css';
3537
import 'vue-toast-notification/dist/theme-sugar.css';
3638

3739
const app = createApp({});
38-
app.use(VueToast);
40+
app.use(ToastPlugin);
3941
app.mount('#app');
4042

41-
//Vue.$toast.open({/* options */});
4243
let instance = app.$toast.open('You did it!');
4344

4445
// Force dismiss specific toast
4546
instance.dismiss();
47+
4648
// Dismiss all opened toast immediately
4749
app.$toast.clear();
4850
```
4951

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+
5072
## Available options
5173

5274
The API methods accepts these options:

0 commit comments

Comments
 (0)