• vue路由DEMO


    index.js,index.vue,course.vue,master.vue等

    import Vue from 'vue'
    import Router from 'vue-router'
    import Index from '@/components/index'
    import Course from '@/components/course'
    import Master from '@/components/master'
    Vue.use(Router)
    
    export default new Router({
      routes: [
        {
          path: '/',
          name: 'index',
          component: Index
        },
        {
          path: '/course',
          name: 'course',
          component: Course
        },
        {
          path: '/master',
          name: 'master',
          component: Master
        }
      ]
    })
    <template>
        <div>
            主页
        </div>
    </template>
    
    <script>
        export default{
            name:"index",
            data(){
                return{
    
                }
            }
        }
    </script>
    
    <style scoped>
        
    </style>
    <template>
        <div>
            课程页面
        </div>
    </template>
    
    <script>
        export default{
            name:"course",
            data(){
                return{
    
                }
            }
        }
    </script>
    
    <style scoped>
        
    </style>
    <template>
        <div>
            <ul>
                <li>
                    <router-link to="/">首页</router-link>
                </li>
                <li>
                    <router-link to="/course">课程</router-link>
                </li>
                <li>
                    <router-link to="/master">专家</router-link>
                </li>
            </ul>
        </div>
    </template>
    
    <script>
        export default{
            name:"navlist",
            data(){
                return{
    
                }
            }
        }
    </script>
    
    <style scoped>
        a{
            text-decoration: none;
            color: #333;
        }
        div{
             100%;
            height: 50px;
            background: #F1F1F1;
            line-height: 50px;
        }
        ul{
            list-style: none;
        }
        ul li{
            float: left;
            margin:0 20px;
        }
    </style>

     效果图

  • 相关阅读:
    lsb_release -a 查询Linux系统版本
    html常用标签
    js判断对象是否为空
    springBoot2.x 支持跨域请求配置
    httpclient 上传附件实例
    js 使用sessionStorage总结与实例
    性能测试需求调研分析方法
    jmeter压测实践
    页面加载时调用js函数方法
    IntelliJ IDEA 界面介绍及常用配置
  • 原文地址:https://www.cnblogs.com/wordblog/p/10520690.html
Copyright © 2020-2023  润新知