Vue: In development mode, Vue Warn

Created on 12 Apr 2017  ·  9Comments  ·  Source: vuejs/vue

Version

2.2.6

Reproduction link

https://jsbin.com/wevinulemu/edit?html,output

Steps to reproduce

> parent componts

<template>
  <div>
    {{text}}
    <demo-input v-model="text" > </demo-input>

  </div>
</template>
<script>
  import DemoInput     from 'components/input';

  export default {
    data () {
      return {
        text: ''
      };
    },
    components: {
      DemoInput
    }
  };
</script>
> childern componts

<template>
  <div>
    <input
      type="text"
      class="input-text"
      @input="updateInput($event.target.value)"
      :value="inputValue"
      ref="input"
      :placeholder="placeholder"
    >
  </div>
</template>

<script>
  import './style.less';

  export default {
    data () {
      return {

      };
    },
    props: {
      value: {
        default() {
          return '';
        }
      },
      placeholder: {
        type: String,
        default() {
          return '';
        }
      }
    },
    computed: {
      inputValue() {
        return this.value;
      }
    },
    methods: {
      updateInput(value) {
        this.$emit('input', value);
      }
    }
  }
</script>

When input to content

What is expected?

not have warn.

What is actually happening?

when update data->text, have warn.


Please forgive for my English is not good.

need repro

All 9 comments

Why don't you use :value="value" on your child component? You should not use computed properties for your model.

https://jsbin.com/wevinulemu/edit?html,output

This code is not runnnable, so it does not count as a reproduction. Please provide a reproduction.

jdbin.com pop: "Sorry this bin is too large for us to save"
so, I submitted the code to " https://github.com/KellerLong/vue-question.git "
and
use :value="value" have error too


Please forgive for my English is not good.

Sorry, I can't read a whole app's bundled webpack code. Please provide source code for. minimal reproduction - that means the minimum of code for this problem to appear.

Sending us your whole app will make our work very hard.

Sorry, Inconvenience to the team, But ,This problem only occurs when 'new webpack.HotModuleReplacementPlugin()' and develop state is used, Can me create a webpack-cli?

Sure.

Sorry, I can't reproduce, Demo is no problem.I don't know why there's such a mistake,I'll think about what's wrong, ~_~|||

It's been a lot of days

I will close this, you can open a new issue with a proper reproduction if you succeed in recreating the problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franciscolourenco picture franciscolourenco  ·  3Comments

julianxhokaxhiu picture julianxhokaxhiu  ·  3Comments

gkiely picture gkiely  ·  3Comments

lmnsg picture lmnsg  ·  3Comments

bfis picture bfis  ·  3Comments