кнопка будет disabled, если все три поля input будут пустые и наоборот, если все поля заполнены, то кнопка станет enabled
const button = document.querySelector('селектор кнопки');
const inputs = [...document.querySelectorAll('селектор инпутов')];
const onInput = () => button.disabled = inputs.every(n => !n.value);
inputs.forEach(n => n.addEventListener('input', onInput));
onInput();
every
будет some
. onMarkerMouseOver() {
this.openPopup();
}
<Marker onMouseOver={this.onMarkerMouseOver}>
<Input handleInput={this.handleInput} />
onChange={this.props.handleInput}
$('.cart_qty').change(({ target: t }) => {
$(t)
.closest('селектор блока с товаром')
.find('.shopcart__item-total')
.text(function() {
return t.value * this.dataset.price;
});
});
document.querySelectorAll('.cart_qty').forEach(n => n.addEventListener('change', onChange));
function onChange({ target: t }) {
const total = t.closest('селектор блока с товаром').querySelector('.shopcart__item-total');
total.innerText = t.value * total.dataset.price;
}
data: () => ({
value: '',
values: [ 'hello, world!!', 'fuck the world', 'fuck everything' ],
}),
<input v-model="value">
<button v-for="(n, i) in values" @click="value = n">set value #{{ i + 1 }}</button>
data: () => ({
scroll: 0,
}),
computed: {
style() {
return {
height: здесь рассчитываете высоту на основе this.scroll,
};
},
},
created() {
const onScroll = () => this.scroll = document.scrollingElement.scrollTop;
onScroll();
document.addEventListener('scroll', onScroll);
this.$on('hook:beforeDestroy', () => document.removeEventListener('scroll', onScroll));
},
<div :style="style">
const options = [
[ 'hello, world!!', 'fuck the world', 'fuck everything' ],
500,
console.log,
];
function interval(arr, delay, callback) {
let i = -1;
return arr.length
? setInterval(() => callback(arr[i = -~i % arr.length]), delay)
: null;
}
const intervalId = interval(...options);
// надо остановить хождение по кругу, делаем так: clearInterval(intervalId);
function interval(arr, delay, callback) {
let timeoutId = null;
arr.length && (function step(i) {
timeoutId = setTimeout(() => {
callback(arr[i]);
step((i + 1) % arr.length);
}, delay);
})(0);
return () => clearTimeout(timeoutId);
}
const stop = interval.apply(null, options);
// надо остановить, делаем так: stop();
computed: {
grouped() {
return this.dataTable.reduce((acc, n) => {
(acc[n.customer.name] = acc[n.customer.name] ?? []).push(n);
return acc;
}, {});
},
},
<template v-for="(items, customer) in grouped">
<tr>
...
</tr>
<tr v-for="item in items">
...
</tr>
</template>
function xxx(key) {
let val = entityTree[key];
const nextKey = Array.isArray(val) && (val = [...val], val.pop());
return val ? [].concat(key, val, xxx(nextKey)) : [];
}
v-for="image in images"
должно быть v-for="image in result.images"
.v-model="profileImg"
и {{profileImg}}
должно быть v-model="result.profileImg"
и {{ result.profileImg }}
.name="profileImg"
значение name должно вычисляться динамически, в зависимости от result (например - добавляйте id, если есть, или индекс).<li>{{ result.sizes.join(' ') }}</li>
должно быть <li v-for="size in result.sizes">{{ size }}</li>
.