0

I want to pass data from my vue file to another component which is present in the layout part. I know i can use props but for using props I need to initialize the component in the vue file from which I want to pass the data. But I don't want to initialize the component on my Vue I just want to pass the data.

here is the below structure. in my default.vue i have these 2 components.

  <right-side-bar-org  v-if="$route.name=='organisation'"></right-side-bar-org>
  <right-side-bar-search  v-if="$route.name=='search'"></right-side-bar-search>

I have declared the component with props. But for passing props i have to pass it from my default.vue. But i have this another component search.vue from which i want to pass the data to these components without declaring the component in the search vue. Is there any way to make that happen.

1 Answer 1

0

These problems happen because you're not using a store. Put the data in a new location outside vue, in global scope. Then vue stuff can bind to it when created, unhook when destroyed, and different vms don't even need to know about each other.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.