12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
- <script src="https://cdn.bootcss.com/vue/2.4.2/vue.min.js"></script>
- <script src="https://cdn.bootcss.com/vue-router/2.7.0/vue-router.min.js"></script>
- </head>
- <body>
- <div id="app">
- <h1>Hello App!</h1>
- <p>
-
-
-
- <router-link to="/foo">Go to Foo</router-link>
- <router-link to="/bar">Go to Bar</router-link>
- </p>
-
-
- <router-view></router-view>
- </div>
- <script>
- const Foo = { template: '<div>foo</div>' }
- const Bar = { template: '<div>bar</div>' }
- const routes = [
- { path: '/foo', component: Foo },
- { path: '/bar', component: Bar }
- ]
- const router = new VueRouter({
- routes
- })
- const app = new Vue({
- router
- }).$mount('#app')
- </script>
- </body>
- </html>
|