zoukankan      html  css  js  c++  java
  • 非node环境 vue-rouder 学习笔录4 命名视图

    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>

    <div id="app">
    <h1>Named Views</h1>
    <ul>
    <li>
    <router-link to="/">/</router-link>
    </li>
    <li>
    <router-link to="/other">/other</router-link>
    </li>
    </ul>
    <router-view class="view one"></router-view>
    <router-view class="view two" name="a"></router-view>
    <router-view class="view three" name="b"></router-view>
    </div>
    <script type="text/javascript">
    const Foo = { template: '<div>foo</div>' }
    const Bar = { template: '<div>bar</div>' }
    const Baz = { template: '<div>baz</div>' }
    const router = new VueRouter({
    mode: 'history',
    routes: [
    { path: '/',
    // a single route can define multiple named components
    // which will be rendered into <router-view>s with corresponding names.
    components: {
    default: Foo,
    a: Bar,
    b: Baz
    }
    },
    {
    path: '/other',
    components: {
    default: Baz,
    a: Bar,
    b: Foo
    }
    }
    ]
    })
    new Vue({
    router,
    el: '#app'
    })

    </script>

  • 相关阅读:
    02-高阶函数 map filter sorted
    01-切片的赋值操作
    学习资料记录
    django_初级学习(1)
    git配置使用
    openpyxl操作表格(2)
    openpyxl模块操作excell表格(1)
    精简语法
    MySQL常见面试题
    02-图片转字符画
  • 原文地址:https://www.cnblogs.com/itadong/p/7111666.html
Copyright © 2011-2022 走看看