vuejs, I want to print the parent's ID/name only once for its child
P粉478188786
P粉478188786 2024-04-02 10:44:45
0
1
323

<td v-if="currentId != loop.id" class="text-center">
    <div :set="currentId = loop.id">{{ loop.id }}</div>
</td>
<td v-else></td>

Need to achieve this goal It is a multidimensional parent/child array and needs to be printed on a table. So when the first parent prints on a line, we stop printing duplicate parents until its children are finished. console warning I have set currentId as loop.id, it is showing console warning.

P粉478188786
P粉478188786

reply all(1)
P粉388945432
data() {
  return {
    currentId: '0',
  }
},
methods: {
  assignCurrentId: function(id) {
    if( this.currentId == id) {
        return false;
    } else{
        Object.defineProperty(this, 'currentId', {value: id, writeable: false});
        return true;
    }
}

Found something here to stop/disable the reactivity of variables and it's working now - https://stackoverflow.com/a/52844620/5156910

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!