Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Vue 2 and NuxtJS - style child component from parent

I have a Nuxt.js project (so still using Vue 2) with these two components, I would like to override the child style from the parent, I discovered the ::v-deep pseudo selector but it doesn't seem to be working.

My label always appear as cornflowerblue instead of orange.

Anyone has experienced this before ?

PS: After I get that to work, I'd like to import some styles such as (primaryColor: '#fff') from the setup fonction of the composition API and pass them to my style tag (to allow styles customization from a JSON file). I've seen a few methods can be used (this one for instance or this one). Is there a better approach to it ?

Parent

<template>
  <div>
    <Label class="ui-label" />
  </div>
</template>

<script lang="ts">
import { defineComponent } from '@nuxtjs/composition-api'

export default defineComponent({
  name: 'ParentComponent',
})
</script>


<style lang="scss" scoped>
.ui-label {
  ::v-deep {
    .label {
      color: orange;
    }
 }
}
</style>

Child

<template>
  <div class="label">Abc</div>
</template>

<script lang="ts">
import { defineComponent } from '@nuxtjs/composition-api'

export default defineComponent({
  name: 'Label',
})
</script>

<style lang="scss" scoped>
.label {
  color: cornflowerblue;
}
</style>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The syntax you were actually trying to use is related to Vue3 >> ::v-deep (.label)

In Nuxt as of today, you would need to write ::v-deep .label

Really useful link: https://stackoverflow.com/a/55368933/8816585

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!