I added VueJS to my Django project using webpack loader. Vue works, but i'm very new to it so i'm struggling to understand the structure.
I have the following template:
django_template.html: this is where i'm loading the Vue app
{% load render_bundle from webpack_loader %}
{% block content %}
<div id="app">
<app></app>
</div>
{% render_bundle 'chunk-vendors' %}
{% render_bundle 'chart' %}
{% endblock %}
Now there is my Vue app where i have two basic components, one is testComponent1.vue
<template><h1>This is the test component one</h1></template>
and another is testComponent2.vue:
<template><h1>This is the test component two</h1></template>
Then i have App.vue
<template>
<div>
<testComponent1></testComponent1>
<testComponent2></testComponent2>
</div>
</template>
<script>
import testComponent1 from "./components/testComponent1";
import testComponent2 from "./components/testComponent2";
export default {
name: "App",
components: {
'testComponent1': testComponent1,
'testComponent2': testComponent2,
},
};
</script>
And finally main.js
import Vue from "vue";
import App from "./App.vue";
import axios from 'axios'
import Vuetify from "vuetify";
import "vuetify/dist/vuetify.min.css";
Vue.use(Vuetify);
Vue.config.productionTip = false;
new Vue({
render: h => h(App),
vuetify: new Vuetify()
}).$mount("#app");
Now my question is:
How do i call only a specific component and not all of them? The code i provided will load all the components of the vue app, but since i'm using Vue with Django, on a certain HTML page i will want some component, on another page i'll need another component. Any kind of advice is appreciated!