1👍
In your template, you don’t need the this
. Change it to:
<p>Name {{ patientName }} </p>
But the problem is that you did not define patientName
as an empty string in data. So there is no reactive property.
data(): {
return {
patientName: '',
}
},
Hope this helps.
- [Vuejs]-Nested loop involving date manipulation in Javascript
- [Vuejs]-Vue.js bidirectional calculation on input value
0👍
Suggestions :
- Please verify
response.data.message.patientName
is returning the patient name or not. - In Template, You can access data properties directly by their names with out using
this
keyword. (It will not break anything if you will use that withthis
keyword as well) - To make the property reactive, You should add that in your
data
method.
Live Demo :
new Vue({
el: '#app',
data: {
patientName: ''
},
mounted() {
this.getPatientDetail();
},
methods: {
getPatientDetail() {
this.patientName = 'Alpha'
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<p>{{ this.patientName }}</p>
</div>
Source:stackexchange.com