D
D
dimakal12019-08-02 16:52:29
Vue.js
dimakal1, 2019-08-02 16:52:29

Using data from a Vue loop?

How to use data from v-for in h1 (category)?
Even I don’t understand, tell me pliz
maybe I need to somehow write them into a variable, then when I get it I can transfer them to other components
Code:

<div class="categories">
            <div class="wrapper">
              <ul>
                <li v-for="(category, i) in categories" :key="i">
                  <a :href="category.link">{{ category.text }}</a>
                </li>
              </ul>
            </div>
          </div>
          <div class="wrapper">
            <div class="heading">
              <h1>  {{category.text}} </h1>
            </div>
          </div>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
Olga Veter, 2019-08-02
@vetero4eg

While it looks like this, it should be two different components... Into which the desired category value is either taken or propped through the store

J
jeruthadam, 2019-08-02
@jeruthadam

This is meaningless code.

<div class="categories">
          <div class="wrapper">
            <div class="heading">
              <h1>  {{category.text}} </h1>
            </div>
          </div>

0
0xD34F, 2019-08-02
@0xD34F Vue.js

https://jsfiddle.net/cdofhteu/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question