K
K
kimqar1232021-04-21 11:20:41
css
kimqar123, 2021-04-21 11:20:41

How to prevent certain elements from being displayed through VUE if the “no” field is checked in bitrix?

There is an output of elements that outputs ALL elements:

<div class="apartment-search-results" v-if="showedItems.length">
                    <div class="apartment-search-result" v-for="(item, index) in showedItems" :key="`apart_${item.id}`">
                        <div class="apartment-search-result__caption"><span>{{ item.roomsCount }}</span><span>{{ getWordByNumber(item.roomsCount, ['комната', 'комнаты', 'комнат']) }}</span>
                        </div>
                        <div class="apartment-search-result__image"><img :src="item.image"
                                                                         :alt="`${item.roomsCount} комнаты`"></div>
                        <div class="apartment-search-result__params"><span>Общая площадь</span><span class="big-text">{{ item.space }} м²</span>
                        </div>
                        <div class="apartment-search-result__params"><span>Цена за м²</span><span class="big">{{ item.costPerMeter }} ₽</span>
                        </div>
                        <hr class="block-break">
                        <div class="apartment-search-result__price">{{ item.fullCost }} ₽</div>
                        <a class="button button--expanded button--font-bold button--style-orange" :href="item.url">Узнать
                            подробнее</a>
                    </div>
                </div>

How to make it so that if in Bitrix (for example, I create a custom field with the parameters Sold - "yes" / "no") the value is "no", then vue will not display these elements?
What is the best way to do this? via vue or pure php?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Ukolov, 2018-08-03
@Mike_Ro

Head-on option: https://codepen.io/anon/pen/VBdKZN

A circle as a div given an image as background-image.
If there is no content inside, and its task is exclusively graphic, then it is better to make it a pseudo-element.

L
lamer350, 2018-08-03
@lamer350

margin-top: -[половина высоты круга]px
To make the image on the background take the circle forum:
border-radius: [половина высоты круга]px

P
postya, 2021-04-24
@postya

You don't need to disable, you only need to output those elements that match the value in the field from the backend

<div class="apartment-search-result" v-for="(item, index) in showedItems" :key="`apart_${item.id}`">
<p v-if="item.sold === 'yes'"> Показывает толкьо проданные</p>
</div>

it's not necessary to write
:key="`apart_${item.id}`"
like this
:key="item.id"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question