{
form_id: 12,
submit_btn_text: 'Отправить',
post_url: 'https://someurl.com/api/',
form_fields: [
{ type: 'text', placeholder: 'some plshldr', label: 'some label', field_id: 'some_id' },
{ type: 'text', placeholder: 'some plshldr', label: 'some label', field_id: 'some_id' },
{ type: 'text', placeholder: 'some plshldr', label: 'some label', field_id: 'some_id' }
]
}
<input v-for="field in form_fields" :type="field.type" :placeholder="field.placeholder" v-model="field_models[field.id] />
var arr = [{id: 1}, {id: 2}, {id: 2}, {id: 1}, {id: 1}, {id: 1}];
var counter = arr.reduce(function (o, i) {
if (!o.hasOwnProperty(i.id)) {
o[i.id] = 0;
}
o[i.id]++;
return o;
}, {});
var result = Object.keys(counter).map(function (id) {
return {id: id, sum: counter[id]};
});
{{ dataGet.slice(0, offset) }}
offset: 10
<Knopka v-if="offset < dataGet.length" @click="showMore" />
showMore(){
this.offset += 10
}
get('https://lala.ru/?offset=' + this.offset)
.then(response => this.dataGet = [...this.dataGet, ...response.data])
$(document).ready(fucntion() {
var slidesCount = $('.slide-item').lenght
if(slidesCount > 1) {
$('.slider-wrapper').slick();
}
}}
const digitsOnly = str => str.replace(/\D/g, '');
// или
const digitsOnly = str => (str.match(/\d/g) ?? []).join('');
// или
const digitsOnly = str => ''.concat(...str.matchAll(/\d/g));
// или
const digitsOnly = str => str.split(/\D/).join``;
// или
const digitsOnly = str =>
Array.prototype.reduce.call(
str,
(acc, n) => acc + ('0123456789'.includes(n) ? n : ''),
''
);
document.querySelectorAll('span').forEach(n => {
n.innerText = digitsOnly(n.innerText);
});
// или
for (const n of document.getElementsByTagName('span')) {
n.textContent = digitsOnly(n.textContent);
}
<?php if ( have_posts() ) : $ir = 0; while ( have_posts() ) : the_post();
if ( $ir == 0 ) {
get_template_part( 'template-parts/article-wide' );
} else {
get_template_part( 'template-parts/article' );
}
$ir++; endwhile; endif; ?>
выборку постов