In this code like in line 19 i want to pass document.body.getElementById('calculationid').value to a vue variable (calcvalue) but it does not work, so how i can solve it or is there any other solutions to get the input tag value .
<template>
<div class="home">
<input type="text" v-model="calcoperation" id="calculationid" >
</div>
</template>
<script>
export default{
name:"home",
data(){
return{
var calcvalue : document.body.getElementById('calculationid').value ,
title: "",
valuecalc: "",
calcoperation: ""
// valuecalc: calcoperation
};
},
methods:{
//To contact the input field text with the button pressed
contterms(str){
var temp = "" + str
this.calcoperation = this.calcoperation + temp
}
},
mounted(){
fetch("http://localhost:8085")
.then(response =>{
return response.text();
})
.then(data =>{
this.title=data;
});
}
};
</script>