M
M
MeMoJlor2021-12-08 10:31:47
Vue.js
MeMoJlor, 2021-12-08 10:31:47

How to add class to active taboo?

Good afternoon. There are tabs:

<template>
  <section class="navbar">
    <div class="tabs">
        <div class="tab" @click="$router.push('/')">
          <span>Мой профиль</span>
        </div>
        <div class="tab" @click="$router.push('/stat')">
          <span>Статистика</span>
        </div>
        <div class="tab" @click="$router.push('/diary')">
          <span>Дневник</span>
        </div>
    </div>
  </section>
</template>


I would like to assign a class to an active taboo. Tell me how this can be implemented? Use :class?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2021-12-08
@MeMoJlor

<div class="tab" @click="$router.push('/')">

Replace this nonsense with router-link. There , the addition of the class has already been implemented , it remains only to prescribe the styles for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question