3
Using the Vue-router, I came across a problem, when I weigh a dynamic route, like
{ path: '/horario/:dia/:hora', component: Bar },
a problem happens, I can access the values of day and time on the target page, this because it is a template, however, I need this information, I am using a template file . see.
He is:
<template>
<div></div>
</template>
<script>
export default {
mounted() {
console.log(dia);
console.log(hora);
console.log('Component mounted.')
},
data(){
return {
}
}
}
</script>
You know how to compile files
.vue
in a single for Vue to use? Then inside the component just use the$route
, for example within themounted
you may haveconsole.log(this.$route.params);
– Sergio
I know, however, the numbers are as follows, ":n", where n is the number, I would just like to have n without parsing.
– Andersoney Rodrigues
Can you set an example to replicate that? I’m doubtful if I understand the problem.
– Sergio
Solved, I was using a link in the form of http://(link_site)/time/:3/:4, and only needed the number
– Andersoney Rodrigues