Skip to content

1.0.18 change detection caveats #2549

@taoche

Description

@taoche

Vue.js version

1.0.18

parent component

<template>
  <div id="app">
    <img class="logo" src="./assets/logo.png">
    <hello :list="list"></hello>
  </div>
</template>

<script>
import Hello from './components/Hello'

export default {
  data () {
    return {
      list: [{
        name: 'test-example1',
        id: 1
      },
      {
        name: 'test-example2',
        id: 2
      },
      {
        name: 'test-example3',
        id: 3
      }]
    }
  },
  components: {
    Hello
  }
}
</script>

<template>
<div class="hello">
  <h1>{{ msg }}</h1>
  <li v-for="item in list" track-by="$index">{{item.name}}</li>
  <button @click="clickHandle">push item</button>
</div>
</template>

<script>
var mockData = {
  name: 'test',
  id: 'test',
  test: false
}

export default {
  props: ['list'],
  data () {
    return {
      msg: 'Hello World!'
    }
  },
  created () {
    // mock code
    this.list = this.list.map(item => {
      return {
        name: item.name,
        id: item.id,
        test: false
      }
    })
  },
  methods: {
    clickHandle () {
      this.list.push(mockData)
    }
  }
}
</script>

It can work in version 1.0.17 But in the 1.0.18 version, I click on the button .data is changed, but the list is no rendering

I do not see the changes for this feature for read the relase note
I do not know if I missed something, hoping to get answers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions