W
W
WebDev2018-07-06 11:27:36
Vue.js
WebDev, 2018-07-06 11:27:36

What is the correct way to access parent data in vue.js?

I am developing an application using vue-cli.
Structure of components
-Profile
--Settings
---PrivateSettings
That is, in the Profile component, the Settings component is connected, in which PrivateSettings is connected.
In Profile, when creating, I receive and save information about the authorized user.
In Settings, in order not to repeat the request to the server, I address the user through $parent.user, and in PrivateSettings through $parent.$parent.user.
Is it possible to somehow access the property of a particular component, without using $parent?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fl3nkey, 2018-07-06
@kirill-93

Use Vuex or props

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question