Mostly new at frontend, definitely new at Vue. I'm trying to read query parameters from the URL. Following How can I get query parameters from a URL in Vue.js? and https://router.vuejs.org/guide/#javascript
I now have this code:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router/dist/vue-router.js"></script>
</head>
<body>
<div id="app">
{{message}}
</div>
<script>
const routes = [];
var router = new VueRouter({
routes
});
var vm = new Vue({
el: '#app',
router,
data: {
message: this.$route.query
}
});
</script>
</body>
</html>
However, running it in Chrome or Firefox yields an "cannot read property of 'query' of undefined"
Defining routes and creating links to them and loading them, as also described in that VueRouter guide works. So it looks like the VueRouter is loaded?
What am I doing wrong?