import Vue from 'vue'
import Router from 'vue-router'
import Hello from '../components/Hello'//首页
import Test from '../components/test'//需要跳转的页面 给组件重新命名
Vue.use(Router)
export default new Router({
routes: [
{//首页
path: '/',
name: 'Hello',
component: Hello
},
{//需要跳转的页面
path:'/test',
name:'test',
component:Test//组件名字
}
]
})
<template>
<div id="app">
<img src="./assets/logo.png">
<p>
<router-link to="/home">home</router-link>//跳转首页
<router-link to="/test">test</router-link>//跳转新页面
</p>
<router-view></router-view>//页面渲染放置的部分
</div>
</template>
<script>
export default {
name: 'app'
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
import Vue from 'vue'
import App from './App'
import router from './router'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
}).$mount('#app')//实例挂载到元素中
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有