How to realize all selection and reverse selection in Vue
Most people do not understand the knowledge points of this article "how to achieve full selection and inverse selection in Vue", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to achieve full selection and reverse selection in Vue" article.
The first step is to create your own input and add an input:CheckBox in front of the mx.txt. Add the mx.check you create every time to v-model.
The most important thing is to traverse the forEach, and what comes out is current.
What some people don't notice is why there is no such thing as check: [] in data.
Data is real-time monitoring, you click to automatically turn all the check into true.
Select all
{{mx.txt}} export default {data () {return {txt: ", list: []}}, methods: {ck () {this.list.push ({txt: this.txt, check: false}) this.txt ="}, checkAll () {this.list.forEach ((mx) = > {mx.check =! mx.check})} .check {cursor: pointer; button {cursor: pointer; border: 0; padding: 10px 30px Background: # 000; color: # fff; border-radius: 100px; margin-bottom: 10px; outline: none;} input {padding: 15px; width: 300px; border: 0; box-shadow: 00 15px # ccc;} ul {width: 300px; padding: 0; cursor: pointer; box-shadow: 00 15px # ccc; min-height: 300px; padding: 15px; list-style: none; li {cursor: pointer; margin-bottom: 12px; > input {padding: 0; width auto: } the above is about the content of this article on "how to achieve full selection and reverse selection in Vue". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to learn more about related knowledge, please follow the industry information channel.