0π
Iβm not 100% sure about camelCasing for groupId so Iβm using groupid. Try it out, and let us know about camelCase in the comments.
props: {
//you could set the watch to this if you need.
//groupid: {default: 1}
},
watch: {
$route(to, from) {
var groupid = (typeof to.params.groupid != 'undefined') ? to.params.groupid : 1;
//... do some stuff
}
},
- [Vuejs]-How to fix plugin error appear inside TinyMCE 4 editor
- [Vuejs]-How to fix plugin error appear inside TinyMCE 4 editor
0π
In order to display data from the route params you should be doing something like this
// start route.js
export default new Router({
mode: 'hash', // https://router.vuejs.org/api/#mode
routes: [
{
path: 'my-route/:criminal',
name: 'MyRoute',
component: MyComponent
}
]
})
// End route.js
<template>
<section>
<div>
{{criminals}}
</div>
</section>
</template>
<script>
export default {
name: 'CriminalProfile',
data(){
return {
criminals: ''
}
},
created(){
this.criminals = this.$route.query.myparam
}
}
</script>
Here itβs the router link
<router-link :to="{ name: 'CriminalView', params: { criminalId: 123 }}">Criminal</router-link>
- [Vuejs]-Content of the website goes beside the toolbar instead of below
- [Vuejs]-SPA extensible by user
0π
In my case this work perfectly,
Try this:
Using this.$route.params.paramName
you can access params in router-view component.
<script>
export default{
data() {
criminal_id:'',
criminal_data: ''
},
created() {
this.criminal_id = this.$route.params.criminalId;
this.criminal_data = this.$route.params.criminal;
}
}
</script>
- [Vuejs]-Put prismic fields in an array to be used in v-select :items prop for vuetify project?
- [Vuejs]-Vuejs $emit in confirm dialog invalid
Source:stackexchange.com