3 years ago

VueJs cannot hande identical data in v-for

Posted 3 years ago by keevitaja

Hi, i am pretty sure it is me... so how to do it the correct way.

<div id="main">
    <p><a href="#" @click="append()">add</a></p>
    <p v-for="row in rows">{{{ }}}</p>
'use strict';

let i = 1;

const main = new Vue({
    el: '#main',
    data: {
        rows: []
    methods: {
        append: function() {
            this.rows.push({data: 'testing ...', id: i});

This works as expected. Each time when i click append, the row gets appended. But if i try to push identical string this.rows.push('testing ...) then a row will appended only the after the first click,

Please sign in or create an account to participate in this conversation.