如何解决:使用 v-model 时,内联检查属性将被忽略

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

我正在创建一个 en VueJS 组件,当我创建以下复选框时:

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

我一直收到错误消息: inline checked attributes will be ignored when using v-model. Declare initial values in the component's data option instead.

但我已经有了

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

在组件中。为什么我总是收到此错误?

您必须从输入标签中删除 checked="checked"