<a
v-for="city in cities"
@click="selectedCity = city.name"
class="dropdown-button__item dropdown-item"
>{{ city.name }}</a>
computed: {
maps() {
return (this.cities.find(n => n.name === this.selectedCity) || {}).transport;
},
},
<div class="how-to-get__map-wrap" v-if="maps">
<iframe v-for="map in maps" :src="map.mapLink" frameborder="0" allowfullscreen="true"></iframe>
</div>
Чекбоксы кастомные и при втором клике на один из них - они полностью игнорируют свойства checked и disabled
$list.find('input').click(e => e.stopPropagation());
if (!$(e.target).is('input')) {
$list.hide();
}
.slice(1)
там, где работаете со строками таблицы. Т.е., вместо$('#data tbody tr').hide();
$('#data tbody tr').slice(0, rowsShown).show();
$('#data tbody tr').slice(1).hide().slice(0, rowsShown).show();
$('#data tbody tr').css('opacity',...
$('#data tbody tr').slice(1).css('opacity',...
str.match(/rgb\(.*\)/).pop().match(/\d+/g)
str.match(/rgb\((.*)\)/).pop().split(', ')
projectTechnologies.innerHTML = technologyHandler(dataTechnologies).map((el) => el);
projectTechnologies.innerHTML = technologyHandler(dataTechnologies).map(n => n.outerHTML).join('');
// или
technologyHandler(dataTechnologies).forEach(n => projectTechnologies.appendChild(n));
// или
for (const n of technologyHandler(dataTechnologies)) {
projectTechnologies.insertAdjacentElement('beforeend', n);
}
// или
projectTechnologies.append(...technologyHandler(dataTechnologies));
technologyHandler
следующим образом:const technologyHandler = str => str
.split(' ')
.map(n => `<p class="project_technologies-item">${n}</p>`)
.join('');
// или
const technologyHandler = str =>
str.replace(/ ?(\S+)/g, '<p class="project_technologies-item">$1</p>');
map
после её вызова:projectTechnologies.innerHTML = technologyHandler(dataTechnologies);
:href="`https://oauth.vk.com/authorize?client_id=${client_id}`"
computed: {
href() {
return `https://oauth.vk.com/authorize?client_id=${this.client_id}`;
},
},
:href="href"
methods: {
href: client_id => `https://oauth.vk.com/authorize?client_id=${client_id}`,
},
:href="href(client_id)"
const digits = Object
.entries([...`${num}`].reduce((acc, n) => (acc[n] = (acc[n] || 0) + 1, acc), {}))
.reduce((acc, n) => (n[1] > 1 && acc.push(+n[0]), acc), []);
const digits = num
.toString()
.split('')
.reduce((acc, n) => (acc[n]++, acc), Array(10).fill(0))
.map((n, i) => n > 1 && i)
.filter(n => n !== false);
const digits = Array
.from(String(num), Number)
.filter((n, i, a) => i !== a.indexOf(n))
.filter((n, i, a) => i === a.indexOf(n));
const digits = (('' + num)
.match(/\d/g)
.sort()
.join('')
.match(/(\d)\1+/g) || [])
.map(n => n[0] | 0);
const values = [ 'text', 'move', 'lols' ];
const selector = values.map(n => `[data-cmd="${n}"]`).join(', ');
const elements = document.querySelectorAll(selector);
elements.forEach(n => n.style.display = 'none');
$('.count').on('input', e => $('.game_iframe').width(e.target.value));
document.querySelector('.count').addEventListener('input', function() {
document.querySelector('.game_iframe').style.width = `${this.value}px`;
});