Я хочу, чтобы получить доступ к внутреннему <input>
элемента после того, как он был создан Vue:Как определить, когда Vue закончил обновление DOM?
<li v-repeat="subtask: subtasks">
<input v-model="subtask.name" type="text">
</li>
Однако этот код не работает:
/* add a new item (that in turn will create a new DOM node) */
subtasks.push({
name: 'wash the dishes',
id: 'box-123'
});
/* ... Around now, Vue should get busy creating the new <li> ... */
/* Now the element should exist, but it doesn't */
console.log(document.getElementById('box-123'));
// --> null
Однако, getElementById
вызова возвращается пустой handed- - узел в это время не существует.
Когда я могу быть уверен, что Vue создал/обновил DOM?