M
M
MikUrrey2021-06-22 16:08:14
Vue.js
MikUrrey, 2021-06-22 16:08:14

Why are changes to data delayed?

Greetings.
Essence: there is an array of data, under which a number of custom checkboxes are displayed in a loop.
To make them some kind of label, I add
But for some reason, the change gets into the data only after nextTick (that is, when something induces the parent component to redraw). How so, in which direction to dig?

<template>
<div v-for="(day, key) in $options._weekDays" :key="key">
    <v-simple-checkbox v-model="innerValue[key][0]"></v-simple-checkbox>
    <div @click="innerValue[key][0] = !innerValue[key][0]">{{day}}</div>
</div>
</template>
<script>
export default {
    _weekDays: {
        monday: "Понедельник",
        tuesday: "Вторник",
        wednesday: "Среда",
        thursday: "Четверг",
        friday: "Пятница",
        saturday: "Суббота",
        sunday: "Воскресенье",
    },
    data() {
        return {
            innerValue: {
                monday:    [false, "", ""],
                tuesday:   [false, "", ""],
                wednesday: [false, "", ""],
                thursday:  [false, "", ""],
                friday:    [false, "", ""],
                saturday:  [false, "", ""],
                sunday:    [false, "", ""],
            },
        }
    },
}
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2021-06-22
@MikUrrey

for some reason, the change gets into the data only after nextTick (i.e. when something induces the parent component to redraw)

Yah? How did you check it? By the appearance of the component? Suddenly, the data update still occurs, but the subsequent rendering of the component associated with it (update) does not? It happens .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question