v-memo support deep comparison of object
What problem does this feature solve?
<div v-memo="[data]">{{ data.time }}</div>
A property change in a deep object can't trigger update.
<div v-memo="[JSON.stringify(data)]">{{ data.time }}</div>
JSON stringify is not a good idea, but I have to do. demo
What does the proposed API look like?
maybe like this
<div v-memo.deep="[data]">{{ data.time }}</div>
使用
import { toRaw } from 'vue';
和[toRaw(data)]
?
<li v-memo="[toRaw(data)]">{{ data.time }}</li>
I updated it to the demo. This doesn't seem to work.
use
[data.time]
instead, it compared each value with its before value
If time is object type data, this may not work