$('.calculator_price')
.find('.calculator_price__item:lt(6)')
.css('display', 'flex');
$('.calculator_price .calculator_price__item')
.filter((i, n) => $(n).index() < 6)
.css('display', 'flex');
document.querySelectorAll('.calculator_price').forEach(n => {
[...n.querySelectorAll('.calculator_price__item')]
.slice(0, 6)
.forEach(n => n.style.display = 'flex');
});
v-if
/ v-else
следует добавить элементам массива свойство, которое будет указывать на необходимость назначения класса. Так пойдёт? <div id="inputs">
<input maxlength="5">
</div>
const $inputs = $('#inputs').on('input', 'input', function() {
const $this = $(this);
const maxlen = +$this.attr('maxlength');
if ($this.val().length === maxlen) {
let $next = $this.next();
if (!$next.length) {
$next = $(`<input maxlength="${maxlen}">`).appendTo($inputs);
}
$next.focus();
}
});
// или
document.querySelector('#inputs').addEventListener('input', function(e) {
const input = e.target;
const maxlen = +input.getAttribute('maxlength');
if (input.value.length === maxlen) {
if (!input.nextElementSibling) {
this.insertAdjacentHTML('beforeend', `<input maxlength="${maxlen}">`);
}
input.nextElementSibling.focus();
}
});
div.classList.remove(...[...div.classList].filter(n => n.indexOf('_key-word') !== -1))
{ user: { city: { name: "..." } } }
, а будет { userCityName: "..." }
или { user_city_name: "..." }
, как-то так.return itemData && monthData
.return itemData || monthData
.data: {
filters: {
'какое-то свойство': {
value: какое-то дефолтное значение,
compare: (itemValue, filterValue) =>
сравнение значений фильтра и элемента фильтруемого массива
},
...
},
...
<input v-model="filters.xxx.value">
<select v-model="filters.yyy.value">
computed: {
filteredItems() {
return Object.entries(this.filters).reduce((items, [ key, filter ]) => {
return items.filter(item => filter.compare(item[key], filter.value));
}, this.items);
},
...
false
, подсовывайте какое-то корректное дефолтное значение, в данном случае - пустую строку:(item._Name || '').trim()
item._Name?.trim?.() ?? ''
<td v-for="(n, i) in row">
<input @keydown.tab="i === row.length - 1 ? onTab(n) : null">
</td>
<div v-for="n in 11">{{ n + 29 }}</div>
<div v-for="n in 40" v-if="n >= 30">{{ n }}</div>
<div v-for="n in values">{{ n }}</div>
values: [ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 ],
<div v-for="n in getValues(30, 40)">{{ n }}</div>
getValues(lower, upper) {
return [...Array(upper - lower + 1)].map((n, i) => lower + i);
},