How to search and edit in v-for?
-
registrar () {
if (this.editarid == null) {
this.$v.$touch()
if (!this.$v.$invalid) {
this.items.push({
uuid: ‘efrc-ec4c-65v0-34o’ + this.nextTodoid++,
descripcion: this.formData.descripcion
})
this.formData.descripcion = ‘’
Notify.create({
message: ‘Área Registrada’,
color: ‘green-13’,
icon: ‘checkmark-outline’
})
this.dialog = false
this.formData.descripcion = ‘’
}
} else {
alert(this.editarid)
this.items.$set(
this.editarid, {
descripcion: this.descripcion
}
)
}
},
editar (index) {
this.editarid = index
this.dialog = true
},
borrar (index) {
Swal.fire({
title: ‘¿Quieres Eliminir el Área?’,
type: ‘warning’,
showCancelButton: true,
confirmButtonColor: ‘#3085d6’,
cancelButtonColor: ‘#d33’,
confirmButtonText: ‘Si, Eliminar’,
cancelButtonText: ‘Cancelar’,
reverseButtons: true
}).then((result) => {
if (result.value) {
this.items.splice(index, 1)
Swal.fire(
‘Eliminado’,
‘Se ha elimnodo el Área.’,
‘success’
)
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
Swal.fire(
‘Cancelado’,
‘:)’,
‘error’
)
}
})
}, -
Puedes poner ese codigo en un bloque rodeado por ``` ? Seria mucho mas facil entenderlo con resaltado de sintaxis y margenes correctos.
Otra pregunta: por que quieres buscar en
v-for
y no en el script?