Answer the question
In order to leave comments, you need to log in
How to perform the operation once?
There is a form that is filled in a loop
<form>
<div class="form-group" v-for="(item, index) in info">
<label>{{item.name}} <i class="fas"></i></label>
<input type="text" class="form-control" v-model="info[index].title"
@input="updateData($event, item)">
</div>
<button class="btn btn-success">Send Data</button>
</form>
methods: {
updateData(e, item) {
let i = 0
console.log()
if (!item.pattern.test(item.title)) {
e.target.classList.add('is-invalid')
e.target.classList.remove('is-valid')
e.target.previousElementSibling.lastElementChild.classList.add('fa-exclamation-circle')
e.target.previousElementSibling.lastElementChild.classList.remove('fa-check-circle')
} else {
e.target.classList.remove('is-invalid')
e.target.classList.add('is-valid')
e.target.previousElementSibling.lastElementChild.classList.remove('fa-exclamation-circle')
e.target.previousElementSibling.lastElementChild.classList.add('fa-check-circle')
}
}
}
Answer the question
In order to leave comments, you need to log in
https://ru.vuejs.org/v2/guide/syntax.html
won't v-once syntax work?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question