juliangonzalez
juliangonzalez

Reputation: 4381

How to solve: inline checked attributes will be ignored when using v-model

I'm creating a component en VueJS and when I created the following checkbox:

<div class="checkbox-inline">
    <label><input type="checkbox" checked="checked" v-model="sendEnter">Send with Enter</label>
  </div><!-- /.checkbox -->

I kept getting error: inline checked attributes will be ignored when using v-model. Declare initial values in the component's data option instead.

But I already had

  data(){
   return{
     textMsg: '',
     sendEnter: 'checked'
   }
  }

In the component. Why I keep getting this error?

Upvotes: 1

Views: 675

Answers (1)

juliangonzalez
juliangonzalez

Reputation: 4381

You have to remove checked="checked" from the input label.

Upvotes: 3

Related Questions