Skip to content

Commit

Permalink
Add plugin's config arg for customize the component's name (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgraziani2712 authored and euvl committed Nov 29, 2018
1 parent 3c902e0 commit 3c7a157
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,21 @@ Vue.notify({
})
```

### Custom instance configuration

All configurations are optional.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| name | String | notify | Defines the instance name. It's prefixed with the dollar sign. E.g. `$notify` |
| componentName | String | notifications | The component's name |

### Props

All props are optional.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| --- | --- | --- | --- |
| group | String | null | Name of the notification holder, if specified |
| type | String | null | Class that will be assigned to the notification |
| width | Number/String | 300 | Width of notification holder, can be `%`, `px` string or number.<br>Valid values: '100%', '200px', 200 |
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Notify = {
this.installed = true
this.params = args

Vue.component('notifications', Notifications)
Vue.component(args.componentName || 'notifications', Notifications)

const notify = (params) => {
if (typeof params === 'string') {
Expand All @@ -22,7 +22,7 @@ const Notify = {
}
}

const name = args.name ? args.name : 'notify'
const name = args.name || 'notify'

Vue.prototype['$' + name] = notify
Vue[name] = notify
Expand Down

0 comments on commit 3c7a157

Please sign in to comment.