How performant is it to use $parent in vue?

时间:2018-01-11 08:36:28

标签: performance vue.js vuejs2 vue-component

I don't really know how much impact it could have, but I currently have 7 sub-pages and I import them as components in my root "site administration" and need to pass data between them. To be more precise, each sub route allows the user to add, edit and delete certain items in the site administration section.

From what I know, I could just make those sections sub routes and use router-view to show them in the parent page. But then I'd have to add 4 methods in each sub-route. Currently I'm just accessing those functions through $parent.someFuntion(), because I made them generic for any item. However, there are about 8 parent accesses from each child right now (variables and methods).

My question now is: What is more perfomant? Having seperated sub routes with redundant code or accessing the parent's methods with the $parent keyword?

Thanks a lot in advance

0 个答案:

没有答案