简体   繁体   中英

How to set matching array values with conditions using computed property in Vuejs?

 <div> <div v-for="box in boxes":key="box.id"> <BaseAccordian> <template v-slot:title>{{ box.name }}</template> <template v-slot:content> <div v-for="paint in paints":key="paint.id" class="line"> <div> <StatusComponent:box="box":paint="paint":matchingdata="matchingdata" /> <,--only status like ok,not, medium to be printed on line accordingly --> </div> </div> </template> </BaseAccordian> </div> </div>

How to set matching array values in Vuejs?

In my code, I have 3 arrays called, boxes, paints, matchingdata . By using those arrays, i want to perfome the functionality.

After the checkbox is clicked, At present i am showing some information related to paints array

So i need to set the matching array value condition here like.

Do you want to update matchingdata inside your StatusComponent ? This can be done by methods. There is a relevant example in the official vue documentation https://v3.vuejs.org/guide/list.html#v-for-with-a-component .

you don't set matching array values with conditions using computed property in Vuejs, you can use method replace computed property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM