Skip to main content
edited tags
Link
tony19
  • 140k
  • 23
  • 281
  • 354
deleted 3 characters in body
Source Link
user10493964
user10493964

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 ??

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>
    import {MyFunctions} from "@/components/MyFunctions.js";
    export default {
        name:"Miniature",
        computed: {
            useMyFunction() {
                MyFunction("Please do some stuff !");
            }
        }
    }
</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 ??

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:

  export default new Router({
  routes: [
    {
      path: '/certificat/:id',
      name: 'Certificat',
      component: Certificat
    },
    {
      path: '/miniature/:id',
      name: 'Miniature',
      component: Miniature
    }
  ]
})

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 ??

I'm a newbie in javascript and vue.js and I'm facing sommesome 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 addadded the new route in the router definition:

<script>
    import {MyFunctions} from "@/components/MyFunctions.js";
    export default {
        name:"Miniature",
        computed: {
            useMyFunction() {
                MyFunction("Please do some stuff !");
            }
        }
    }
</script>

And then, in the view instanciationvue instantiation, I addadded 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 ??

I'm a newbie in javascript and vue.js and I'm facing somme 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 add the new route in the router definition:

<script>
    import {MyFunctions} from "@/components/MyFunctions.js";
    export default {
        name:"Miniature",
        computed: {
            useMyFunction() {
                MyFunction("Please do some stuff !");
            }
        }
    }
</script>

And then, in the view instanciation, I add 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 ??

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>
    import {MyFunctions} from "@/components/MyFunctions.js";
    export default {
        name:"Miniature",
        computed: {
            useMyFunction() {
                MyFunction("Please do some stuff !");
            }
        }
    }
</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 ??

Source Link
user10493964
user10493964
Loading