Answer the question
In order to leave comments, you need to log in
Why is the component not working in VueJS?
<!DOCTYPE html>
<html lang="en">
<head>
<title>Консультация</title>
{% load staticfiles %}
<script src="{% static 'vue/vue.min.js' %}"></script>
<script src="{% static 'axios/axios.min.js' %}"></script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
p {
padding: 10px;
}
.left {
position: absolute;
left: 0;
top: 0;
width: 35%;
}
.right {
position: absolute;
right: 0;
top: 0;
width: 65%;
}
</style>
</head>
<body id="consultation">
<div class="left">
<consultation :patient_id="{{ patient.id }}"></consultation>
</div>
<div class="right">
Текст
</div>
</body>
<script src="{% static 'patient/consultation.js' %}"></script>
</html>
Vue.component('consultation', {
data() {
return {
patient: null
}
},
prop: ['patient_id'],
template: '<div>TEST</div>',
beforeCreate() {
console.log('test')
}
})
new Vue({
el: '#consultation',
})
Answer the question
In order to leave comments, you need to log in
Little data, but here it is: it :patient_id="{{ patient.id }}"
should look like this::patient_id="patient.id"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question