Created
November 14, 2017 10:21
-
-
Save stefanledin/ddce4bd24363a6b381e0e81fa20eaf0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Does not work! ๐ | |
| export default { | |
| props: ['todo'], | |
| data() { | |
| const data = this.todo; | |
| data.isComplete = false; | |
| return data; | |
| }, | |
| watch: { | |
| isComplete: function(value) { | |
| console.log(value + ' is updated'); | |
| } | |
| } | |
| } | |
| // Does work! ๐ | |
| export default { | |
| props: ['todo'], | |
| data() { | |
| let data = { | |
| isComplete: false | |
| }; | |
| data = Object.assign({}, data, this.todo); | |
| return data; | |
| }, | |
| watch: { | |
| isComplete: function(value) { | |
| console.log(value + ' is updated'); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment