Created
September 1, 2020 07:53
-
-
Save slischka/76fffaef029f7ef4478462a4cf45fd71 to your computer and use it in GitHub Desktop.
DeepDiff vue props
This file contains 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
var DeepDiff = require("deep-diff"); | |
let oldData = JSON.parse(JSON.stringify(this.$props)); | |
this.$watch( | |
(vm: Vue) => vm.$props, | |
(newData: any) => { | |
console.log(DeepDiff.diff(oldData, newData)); | |
oldData = JSON.parse(JSON.stringify(newData)); | |
}, | |
{ | |
deep: true, | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment