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

100
Views
changing css class at page level

This code was working at component level, but when nuxt-child and nuxt-link is used instead of button, it changes the page, but the color remains the same. Do you know how this can be fixed?

<nuxt-link to="/head" :class="headButtonMode" @click="setSelectedTab('head-page')">
</nuxt-link>

<nuxt-link to="/" :class="mainButtonMode" @click="setSelectedTab('main-page')">
</nuxt-link>

<nuxt-child />

data() {
    return {
      selectedTab: "main-page",
    };
  },
  computed: {
    headButtonMode() {
      return this.selectedTab === "head-page" ? "head flat" : "head";
    },
    mainButtonMode() {
      return this.selectedTab === "main-page" ? "main flat" : "main";
    },
  },
  methods: {
    setSelectedTab(tab) {
      this.selectedTab = tab;
    }, 
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try like:

<button @click="setSelectedTab('main-page'); $router.push({path:'/head'})" :class="headButtonMode"> 
</button>
over 4 years ago · Santiago Trujillo 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!