31 课程页面

正常git push代码需要删除node-modules ,那么git pull 拉下来(如果有也需要删除)需要cnpm install,,因为可能node版本不一致。

 

路由跳转

第一步:需要在route的index.js中配置
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import ActualCourse from "../views/ActualCourse";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/actual-course',
    name: 'ActualCourse',
    component: ActualCourse
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router

 

 

 

 第二步:使用js实现路由调整(自己的页面)

this.$router.push('路径')  # 在浏览器就会打开这个地址   

当点击实战课时,如果当前不是要跳转的url_path,就跳转到要跳转的url_path,如果已经是,就不跳转

 

  第三步:跳转外链接

location.href='http://www.baidu.com'

第四步:页面中标签跳转:to指定地址即可(内部地址)

<router-link to="/">       如点击home页的路飞学成的logo,跳转到首页
</router-link>

 

 第五:在根组件中---》以后设置的路由跳转,只会变化router-view内部的

<router-view/>

 

 

 

 

 

 如果是整个页面在变,那么整个页面就是router-view

posted @ 2022-03-01 17:11  甜甜de微笑  阅读(28)  评论(0编辑  收藏  举报