- we dont use
@input
to save changes as it will reset the cursor, so we use@blur
instead
<td contenteditable dir="auto"
v-html="someText"
@keydown.enter.prevent
@input="newEntry()"
@blur="saveNewValue($event)">
</td>
<script>
export default{
data() {
return {
someText: 'abc',
dataChanged: false
}
},
methods: {
newEntry() {
this.dataChanged = true // maybe to enable the submit btn
},
saveNewValue(e) {
// e.target.innerHTML
},
}
}
</script>
Very helpful!