I'm trying to learn vue.js and I have a problem with making routing work. I want to use templates, which are inside other html files, so no inline templates.
What happens is routing is never pinned to my page and I receive no error. I have no clue how to make this work, can you help?
This is my index.html
<!DOCTYPE html>
<html xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>Test</title>
<script src="assets/js/vue.js"></script>
<script src="assets/js/vue-router.js"></script>
<script src="js/routes.js"></script>
</head>
<body>
<div id="app">
<router-link to="/home">Go to home</router-link>
<router-link to="/about">Go to about</router-link>
<router-view></router-view>
</div>
<script src="js/app.js"></script>
</body>
</html>
This is routes.js
var routes = [
{
path: '/home',
template: 'pages/home.html'
},
{
path: '/about',
template: 'pages/about.html'
}
];
and this is my app.js
const router = new VueRouter({
routes // short for routes: routes
});
const app = new Vue({
el: '#app',
router: router
});
I won't be pasting my home.html and about.html because they're just one paragraph without anything.
How can I make this work? And what is extremely important I cannot use imports, requires, anything node/babel and stuff, this is a static page.