Not sure what you're trying to accomplish exactly, but two things are wrong with your code :
- Your
methodkey should be calledmethods - You're accessing and setting
setting.change_setting_valueandsetting.setting_default_valuewhilesettingis not defined in your data properties.
A fixed version of what you posted would be :
const app = new Vue({
el: "#app",
data: {
setting: {
setting_default_value: "default value",
change_setting_value: null
}
},
methods: {
changeSetting(evt) {
if(evt.target.innerText === "") {
// dosen't change in the dom because setting_default_value never change its is the same value as before
// now i want to know how can i change back the contenteditable span when i assign the same value
// i don't want to touch the dom
this.setting.setting_default_value = "default value" // not reflect in the dom what i can do to change the effect
// if i change the default value something else it will change in the dom in this case its the span element
this.setting.setting_default_value = "change value" // reflect in the dom
} else {
this.setting.change_setting_value = "setting value has been change"
}
}
}
});
Now, as I said, I didn't understand what was the expected behavior, but with these fixes you'll get something functional.