watch: {
// whenever question changes, this function will run
question(newQuestion, oldQuestion) {
// your code
}
},
var app=
data(){
return{
mobile: "",
name:{
Vue.createApp ({
firstName:
lastName:
}
};
},
watch:{
mobile(newValue, oldValue){
console.log(newValue);
if (isNaN(newValue)){
alert("Enter valid mobile number");
this.mobile=oldvalue;
}
if (newValue.length == 11){
alert("An OTP has been sent");
}
},
"name.firstName": function (newValue, oldValue){
console.log(newValue, oldValue);
},
name:{
deep: true,
handler: function (newValue, oldvalue){
consolq. log(newValue, oldValue);
}
});