Skip to content

Runtime warning - Invalid prop: type check failed for prop 'container' #161

@hamblin

Description

@hamblin

Versions

  • 1.7.10

Describe the bug

Just installed 1.7.10 (previously running 1.7.8) and I now get a Vue runtime warning about invalid prop for 'container' in plugin options, even using default value for container (document.body).
Exact wording of the warning:
[Vue warn]: Invalid prop: type check failed for prop "container". Expected Object, Function, got HTMLBodyElement

I have it Installed as a plugin (standard Vue CLI, not Nuxt), running Vue 2.6.12.

Toasts still show, but warning is still unexpected.

Expected behavior

Should be able to use like this without prop type check failure.

Steps to reproduce

Reproduction
Steps:

  1. Install 1.7.10 as a plugin (ie: Vue.use(Toast, options))
  2. Use default value for 'container' in options (document.body)
  3. Observe runtime warning for failed prop type check.

Here is my code for installing it as Vue plugin. I get the same result if I don't specify container in options object (use default) or if I explicitly specify container: document.body.
import Toast from "vue-toastification"; const toastificationOptions = { position: 'top-right', timeout: 3000, toastClassName: 'spl-toastification', transition: 'Vue-Toastification__fade', }; Vue.use(Toast, toastificationOptions);

Your Environment

  • Device: MacBook Pro - MacOS 10.15.6
  • Browser: Chrome 87
  • Vue 2.6.12 (full build)

Additional context

I see you made a change to prop validation for plugin options in 1.7.10... so I'm guessing that's where the issue is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions