An exception occurs after the original value is assigned to the data bound by checkbox in vue

implement the editing function of an article. After entering the editing page, the form will get the data of the original article
but bug, appears in the checkbox section. Clicking on one of the checkbox will select all or none of the checkbox, and only true and false
are bound to the array as follows

<div class="wrap classify">
        <label></label>
        <div class="classifyCheckbox">
          <label>vue.js</label>
          <input type="checkbox" value="vue.js" v-model="blog.classify">
          <label>javascript</label>
          <input type="checkbox" value="javascript" v-model="blog.classify">
          <label>CSS</label>
          <input type="checkbox" value="CSS" v-model="blog.classify">
          <label>jQuery</label>
          <input type="checkbox" value="jQuery" v-model="blog.classify">
        </div>
      </div>
 data() {
    return {
      blog: {
        id: null,
        blogTitle: "",
        blogContent: "",
        classify: [],
        type: ""
      },
      types: ["",""],
      submited: false // 
    }
  },
created() {
    // 
    this.blog = this.$store.state.presentBlog;
  }

initially classify only has "vue.js", but the page appears as follows:

clipboard.png
checkbox

clipboard.png
classifyfalse

clipboard.png

what is the problem? Xiaobai asks for help

Jun.16,2021

vue is responsive. Your four v-model share a variable. The state of your four checkbox must be the same, and one changes


.

this place

created() {
  // 
  this.blog = this.$store.state.presentBlog
}

after getting the information, the classify of blog is not an array, is it?

Menu