Vue路由

白昼怎懂夜的黑 提交于 2019-12-23 15:49:19
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>

</style>

</head>

<body>
<div id="app">
<router-link to="/home">路由入口</router-link>
<router-view></router-view>
</div>


<script src="./node_modules/vue/dist/vue.js"></script>
<script src="./node_modules/vue-router/dist/vue-router.js"></script>

<script>
const Home = Vue.component('home', {
template:'<h1>这是路由</h1>'
})


const router = new VueRouter({
routes: [{
path: '/home',
component: Home
}]
})

const vm = new Vue({
el: '#app',
data: {},
router
});
</script>
</body>

</html>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!