<button class="click-count">click me</button>
<button class="click-count">click me</button>
<button class="click-count">click me</button>
document.addEventListener('click', ({ target: t }) => {
if (t.classList.contains('click-count')) {
t.innerText = (t.innerText | 0) + 1;
}
});
// или
const onClick = e => e.target.textContent = -~e.target.textContent;
document.querySelectorAll('.click-count').forEach(n => n.addEventListener('click', onClick));
.imageContainer:empty {
height: 0;
border: none;
}
.imageContainer:empty {
visibility: hidden;
/* или */
opacity: 0;
}
box-sizing: border-box;
для .imageContainer
.flex: 0 0 30%;
у .imageContainer
, а у их родителя пусть будет так:display: grid;
grid-template-columns: repeat(3, 30%);
justify-content: space-between;
<section id="app-pro"> <router-view></router-view> </section>
new Vue({ el: '#app-pro', render: h => h(AppPro), router }).$mount('#app-pro')
Therender
function has priority over the render function compiled fromtemplate
option or in-DOM HTML template of the mounting element which is specified by theel
option.
foreach ($obj_guild['members'] as $m) {
$username = $m['user']['username'];
echo "$username - будет расстрелян<br>";
}
Есть 3 блока, которые хранятся в массиве
let block = document.querySelectorAll(".block");
const index = Array.prototype.indexOf.call(block, e.target);
const index = [...block].findIndex(n => n === e.target);
let index = block.length;
while (index-- > 0 && block[index] !== e.target) ;
$('blockquote').html((i, html) => html.replace(/(©)(.*)$/, '$1<cite>$2</cite>'));
const el = document.querySelector('blockquote');
const html = el.innerHTML;
const index = html.indexOf('©') + 1;
el.innerHTML = `${html.slice(0, index)}<cite>${html.slice(index)}</cite>`;
const el = document.querySelector('blockquote');
el.innerHTML = el.innerHTML
.split('©')
.map((n, i) => i ? '<cite>' + n + '</cite>' : n)
.join('©');
выдаёт неправильную дату
let ts = 1539338750;
data: () => ({
items: [
{ title: 'hello, world!!' },
{ title: 'fuck the world' },
{ title: 'fuck everything' },
].map(n => (n.counter = 0, n)),
}),
<div v-for="n in items">
<button @click="n.counter++">{{ n.title }}</button>
<span>total: {{ n.counter }}</span>
</div>