• Home
  • Jobs
  • Courses
  • Questions
  • Teachers
  • For business
  • ES/EN

0

26
Views
How to access the root component data from a child template in VueJs?

Is is possible to access this.$root from within a template in VueJs ?

Example:

<template>
    <v-card elevation="this.$root.$refs.foo.cardElevation">
      Foo
    </v-card>
</template>

I know I can add a property in the data object and point that to $root.cardElevation, but since I'm going to have many components use this value I'd like to be able to access it directly from the template.

about 1 month ago ·

Juan Pablo Isaza

1 answers
Answer question

0

I don't think access to the root component in such a way is possible and also not the best approach, instead created a config file, imported it and had a data property get the desired config from the configuration file.

about 1 month ago · Juan Pablo Isaza Report
Answer question
Find remote jobs
Loading

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2022 PeakU Inc. All Rights Reserved.