U
U
urajo2019-12-24 07:59:42
JavaScript
urajo, 2019-12-24 07:59:42

How to insert json into html?

i get json

[{
 name: 'Текст1',
 subm:['Текст2', 'Текст3']
}
]

You need to make the script output in a loop
<li class="inner-menu">
                  <div class="otd-menu sub-check" data-sub="true" data-pnd="1" data-otd="4">Текст1<i class="fas fa-plus"></i></div>
                  <div class="div-otd-menu check-sub">
                    <input name="search" value="Текст1" type="checkbox" class="checkbox-otd-none">
                  </div>
                  <ul class="hide-menu">
                    
                      <li>
                        <div class="otd-menu">Текст2</div>
                        <div class="div-otd-menu">
                          <input value="Текст2" name="search" type="checkbox" class="checkbox-otd">
                        </div>
                      </li>
                    
                      <li>
                        <div class="otd-menu">Текст3</div>
                        <div class="div-otd-menu">
                          <input value="Текст3" name="search" type="checkbox" class="checkbox-otd">
                        </div>
                      </li>	
                  </ul>


There may be multiple objects
[{
 name: 'Текст1',
 subm:['Текст2', 'Текст3']
},
{
 name: 'Текст1',
 subm:['Текст2', 'Текст3']
}
]


That is, in fact, you need to make it under the menu, in which name is the title, and subm are the elements under the menu.
I tried to make a loop in append but I don’t understand how to insert further under the menu

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
beduin01, 2019-12-24
@beduin01

https://ru.vuejs.org/v2/guide/list.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question