![]() And patching in the DOM will not change the icon or image. That is, whenever vue detects the changes on the DOM, it patches them for faster performance. Vue patches with the virtual DOM whenever it is necessary. I just want to make sure I'm doing things the right way and not merely hacking around the issue here. I did some research online but couldn't find an explanation. Why is this happening? I'm fairly new to the world of JS frameworks, so forgive any obvious stuff I might be missing. ![]() ![]() Adding :key makes it work, I imagine because it forces Vue.js to completely re-render the component when favorite is updated. This works well, but one thing that bothers me is that, if I remove the :key property from my template, the icon is not updated when I click on it (even though I have checked that the underlying property is indeed updated correctly). So far I have only implemented the UI part, which looks like this: Īs you can see, the logic is pretty simple. ![]() Clicking on the icon favorites/unfavorites the element. I have a small Vue.js component which displays a favorite star icon. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |