How can I fetch query parameters in Vue.js?
E.g. http://somesite.com?test=yay.
Can’t find a way to fetch or do I need to use pure JS or some lib
More detailed answer to help the newbies of VueJS:
And the code itself:
var router = new VueRouter({
mode: 'history',
routes: []
});
var vm = new Vue({
router,
el: '#app',
mounted: function() {
q = this.$route.query.q
console.log(q)
},
});