What is the difference between renderTracked and renderTriggered in vue3?

Viewed 475

What is the difference between renderTracked and renderTriggered in vue3?

the official explanation is here: https://vue3js.cn/docs/zh/api/options-lifecycle-hooks.html#errorcaptured

I try a demo as below,the two Api got the same args.

renderTracked({ key, target, type }) {
   console.log('renderTracked:', { key, target, type });
},
renderTriggered({ key, target, type }) {
   console.log('renderTriggered:', { key, target, type });
},
1 Answers

renderTriggered

when set data, vue will call this function

renderTracked

when data changed and view updated, will call this function,so renderTracked will called when initial render

Related