Skip to content

[Vue warn]: Invalid prop: type check failed for prop "value".  #2582

@krasendimitrov

Description

@krasendimitrov

In RC-11 no warning is being displayed. RC-12 introduced the property "number" for b-form-input to convert to a native number object, since html5 form input expect and return a string.
This implies that Number should be a valid prop type for the component.
I believe this a issue caused by the introduction of the form-text mixin.
The warning occurs naturally only in development mode.

Code:

<template>
  <div>
    <b-form-input v-model="n" type="number" number placeholder="Enter your number" />
    <div class="mt-2">Value: {{ n }}</div>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        n: 5
      }
    }
  }
</script>

Warning message:

vue.runtime.esm.js?2b0e:619 [Vue warn]: Invalid prop: type check failed for prop "value". Expected String with value "5", got Number with value 5.

found in

---> <BFormInput>
       <NumberField> at src/components/NumberField.vue
         <App> at src/App.vue
           <Root>
  • OS Windows 10, Arch x64, latest Chromium and Firefox
  • Testcase cannot work in the playground since it uses the production version of Vue, so no warnings are displayed. If you require one i can create a project in my repo.
  • dependencies
...
  "dependencies": {
    "bootstrap": "^4.3.1",
    "bootstrap-vue": "^2.0.0-rc.12",
    "vue": "^2.6.6"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.4.0",
    "@vue/cli-plugin-eslint": "^3.4.0",
    "@vue/cli-service": "^3.4.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.13.0",
    "eslint-plugin-vue": "^5.2.1",
    "vue-template-compiler": "^2.6.6"
  }
 ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions