<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>
function movie(card, ticket, perc) {
let count = 0;
let price = ticket;
let sum = card;
while (Math.ceil(sum) >= ticket * count) {
count++;
price *= perc;
sum += price;
}
return count;
}
"User.comparePassword is not a function"
UserSchema.methods.comparePasswords =
(function timeout() {
if (--container.textContent > to) {
setTimeout(timeout, rand(1000, 4000));
}
})();
При этом точно такой же блок кода, но с другим свойством, отлично срабатывает и текст меняется. Отличие в том, что это другое свойство изначально есть в этом объекте campaign, а не устанавливается в created.
const arrayToObject = (array) => { array.reduce(...
return
или убрать фигурные скобки.{id: '1', content: 'Some stuff'},
obj[item._id] = item
как лучше решить задачу преобразования массива в такой объект?
const arrToObj = (arr, key, val = n => n) =>
arr.reduce((acc, n) => (acc[key(n)] = val(n), acc), {});
const obj1 = arrToObj(array, n => n.id);
const obj2 = arrToObj(array, n => n.id, n => n.content);