• 实现vue-router来完成选项卡切换


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>vue-router功能</title>
    <script type="text/javascript" src="js/vue.js"></script>
    <script type="text/javascript" src="js/vue-router.js"></script>
    <style>
    .router-link-exact-active{
    color: #ef3239;
    }
    </style>
    </head>
    <body>

    <div id="app">
    <h1 v-text="title"></h1>
    <p>
    <!-- 使用 router-link 组件来导航. -->
    <!-- 通过传入 `to` 属性指定链接. -->
    <!-- <router-link> 默认会被渲染成一个 `<a>` 标签 使用标签的好处是能在切换模式的时候,router-link会自动修改模式 -->
    <!--可以直接写style、css、id等属性,以及自定义的数据-->
    <router-link to="/">Go to Bar</router-link>
    <router-link to="/bar/bar01">Go to Bar01</router-link>
    </p>
    <!-- 路由出口 -->
    <!-- 路由匹配到的组件将渲染在这里 -->
    <router-view></router-view>
    </div>


    <script type="text/javascript">
    var router = new VueRouter({
    mode:'hash',routes:[
    { path: '/', component: {template:'<div>foo</div>'} },
    { path: '/bar/bar01', component: {template:'<div>bar2</div>'} }
    ]
    });
    var vm = new Vue({
    el:'#app',
    router:router,
    data:{
    title:'Hello vue-router'
    }
    });
    </script>
    </body>
    </html>
  • 相关阅读:
    mojoportal中弹出窗口
    css 层居中
    mojoportal中添加自定义javascript
    C#执行cmd [转载]
    异步委托 学习笔记
    Windows Sysinternals
    有关int,Int32的疑惑解答
    WEB Debug tools汇总
    规范很重要
    [笔记]VGA 接口电阻网络阻抗
  • 原文地址:https://www.cnblogs.com/qiuchuanji/p/7755298.html
Copyright © 2020-2023  润新知