Vue multiple selection checkbox how to change the style after it is selected

as shown in the following figure, how to change the style after vue multiple selection checkbox is selected? (without using element ui)

Feb.27,2021

add a click event to checkbox, and change the class of the element when you click. Class can assign values by binding data


input[type="checkbox"]:checked{
    // 
}

css can realize


just use div

<div :class="{selected:key.checked}" v-for="key,index in data" @click="select(key)">
select(){
    if (!key.isChecked) {
      this.$set(key, 'isChecked', true);
      return;
    }
     key.isChecked = !key.isChecked
}

that's about what it means


as mentioned above, use v-bind:class or v-bind:style to change the style.

Menu