Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds attach container to plugin initialization #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Vue.use(VuetifyToast, {
color: 'purple'
}
},
property: '$toast' // default
property: '$toast', // default
attach: 'body' // default
})
```

Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface VuetifyToastObject {
queueable?: boolean
slot?: Array<any>
shorts?: any
attach: string
}

interface VuetifyToastShow {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function init(Vue, globalOptions = {}) {
let cmp = null
const queue = []
const property = globalOptions.property || '$toast'
const attach = globalOptions.attach || 'body'

function createCmp(options) {
const component = new Vue(Toast)
Expand All @@ -15,7 +16,7 @@ function init(Vue, globalOptions = {}) {
}

Object.assign(component, componentOptions)
document.body.appendChild(component.$mount().$el)
document.querySelector(attach).appendChild(component.$mount().$el)

return component
}
Expand Down