нужно пройтись в сторе по массиву найти у какого объекта stepConditions.active === true ему поставить false, а следующему объекту в stepConditions.active выставить true
case OPEN_NEXT_EXPRESS_FORM_STEP:
const active = 1 + state.findIndex(n => n.stepConditions.active);
return active ? state.map((n, i) => ({
...n,
stepConditions: {
...n.stepConditions,
active: i === active,
},
})) : state;
case OPEN_NEXT_EXPRESS_FORM_STEP:
return state.map((n, i, arr) => ({
...n,
stepConditions: {
...n.stepConditions,
active: !!(i && arr[i - 1].stepConditions.active),
},
}));
arr.propertyIsEnumerable(length) // => true
$(document).on('click', '.sandwitch', function () {
if ($(window).width() < 520) {
$(this).toggleClass('sandwitch--active');
$('.main-menu-list').slideToggle();
}
});
state = { field: newField, currentPlayer: newPlayer };
Object.assign(state, { ... })
. const initialState = {
first: 0,
second: 0,
};
class CounterAction implements Action {
constructor(public type: ActionTypes, public payload: string) {}
}
function counterReducer(state = initialState, action: CounterAction) {
switch (action.type) {
case ActionTypes.Increment:
return {
...state,
[action.payload]: state[action.payload] + 1,
};
...
<div *ngFor="let item of count$ | async | keyvalue">
<button (click)="increment(item.key)">Increment</button>
<div>Current Count: {{ item.value }}</div>
<button (click)="decrement(item.key)">Decrement</button>
<button (click)="reset(item.key)">Reset Counter</button>
</div>
increment(key) {
this.store.dispatch(new CounterAction(ActionTypes.Increment, key));
}
...
function foo(...args) {
console.log(args[N]);
}
function foo() {
console.log(arguments[N]);
}
function foo(...{ [N]: x }) {
console.log(x);
}
selectedServices() {
return this.services.reduce((acc, n) => (n.checked && acc.push(n.title), acc), []);
},
<ul>
<li v-for="n in selectedServices">{{ n }}</li>
</ul>
selectedServices() {
return this.services.filter(n => n.checked);
},
<ul>
<li v-for="n in selectedServices">{{ n.title }}</li>
</ul>
sum() {
return this.selectedServices.reduce((acc, n) => acc + n.cost, 0);
},
const cards = Array.from(
document.querySelectorAll('[data-component="card"]'),
n => new Card(n)
);
constructor(el) {
if (typeof el === 'string') {
return Array.from(document.querySelectorAll(el), n => new Card(n));
}
// дальше всё по-старому
const cards = new Card('[data-component="card"]');
:filter="filterDebet"
.хочу фильтровать по нескольким значениям
data: () => ({
selected: null,
...
}),
<tr v-for="(n, i) in (selected || objSearch)">
@click="selected = selected ? null : { [i]: n }"
.hidden {
visibility: hidden;
}
<tr
v-for="(n, i) in objSearch"
:class="{ hidden: selected !== null && selected !== i }"
>
@click="selected = selected === null ? i : null"
overflow: scroll
или overflow-y: scroll
. Подозреваю, что виноват ".parents()"
.closest('.block')
или .parent().next('.slider-btns')
.