rcs.forEach((residential, i) => {
...
/*
* никакого this при создании попапов не надо - какой смысл делать свойством
* компонента один из многих попапов (т.к. тут цикл, новая итерация - новый
* попап, в результате будет сохранён последний созданный)?
*
* то же касается и координат маркера ниже
*/
const popup = DG.popup({
...
setTimeout(() => {
DG.marker([ residential.latitude, residential.longitude ], { icon: myDivIcon })
.addTo(this.markers)
.bindPopup(popup);
}, i * 200);
});
data: {
datasets: [
{
borderColor: [ 'цвет 1', 'цвет 2', 'цвет 3', ... ],
...
},
],
...
},
const elems = document.querySelectorAll('.itog_price');
elems.forEach((n, i) => n.append(price[i]));
// или
for (const [ i, n ] of elems.entries()) {
n.innerText = price[i];
}
// или
for (let i = 0; i < elems.length; i++) {
elems[i].textContent = price[i];
}
// или
(function next(i, n = elems.item(i)) {
n && (n.appendChild(new Text(price[i])), next(-~i));
})(0);
<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);