I'm a newbie in javascript and vue.js and I'm facing some issue when trying to add a new route in an existing programme.
I created my new component in a separate file called Miniature.vue
I added the new route in the router definition:
<script>
export default importnew Router({MyFunctions} from "@/components/MyFunctions.js";
routes: [
export default {
path: name'/certificat/:"Miniature"id',
computedname: {'Certificat',
component: Certificat
useMyFunction() {},
{
path: '/miniature/:id',
MyFunction("Please do some stuffname: !");'Miniature',
component: }Miniature
}
}]
</script>})
And then, in the vue instantiation, I added my new components and updated the template :
new Vue({
el: '#app',
router,
components: { Certificat, Miniature } ,
template: '<div>
<Certificat></Certificat>
<Miniature></Miniature>
</div>'
})
The previous template was simply
template: '<Certificat/>'
Problem is, the url is either mywebsite/certificat/123 or mywebsite/miniature/123, both routes are executed, and my two components are displayed ! What is the purpose of the template in the Vue constructor anyway? If I remove it, nothing happens.
What am I missing here ??