-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vue-router worked: vuejs/vue-cli#1875
- Loading branch information
1 parent
0239159
commit 66480cc
Showing
4 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import Vue from 'vue' | ||
import App from './App.vue' | ||
import router from './router' | ||
|
||
Vue.config.productionTip = false | ||
|
||
new Vue({ | ||
router, | ||
render: h => h(App), | ||
}).$mount('#app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import VueRouter from 'vue-router' | ||
import Vue from 'vue' | ||
|
||
Vue.use(VueRouter); | ||
|
||
const Foo = { template: '<div>foo</div>' } | ||
const Bar = { template: '<div>bar</div>' } | ||
|
||
// 2. Define some routes | ||
// Each route should map to a component. The "component" can | ||
// either be an actual component constructor created via | ||
// `Vue.extend()`, or just a component options object. | ||
// We'll talk about nested routes later. | ||
const routes = [ | ||
{ path: '/foo', component: Foo }, | ||
{ path: '/bar', component: Bar } | ||
] | ||
|
||
// 3. Create the router instance and pass the `routes` option | ||
// You can pass in additional options here, but let's | ||
// keep it simple for now. | ||
const router = new VueRouter({ | ||
routes // short for `routes: routes` | ||
}); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
runtimeCompiler: true | ||
} |