-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
220 additions
and
54 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
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,20 @@ | ||
import Vue from 'vue' | ||
import App from './App.vue' | ||
<%_ if (options.router) { _%> | ||
import router from './router' | ||
<%_ } _%> | ||
<%_ if (options.vuex) { _%> | ||
import store from './store' | ||
<%_ } _%> | ||
|
||
Vue.config.productionTip = false | ||
|
||
new Vue({ | ||
<%_ if (options.router) { _%> | ||
router, | ||
<%_ } _%> | ||
<%_ if (options.vuex) { _%> | ||
store, | ||
<%_ } _%> | ||
render: h => h(App) | ||
}).$mount('#app') |
23 changes: 23 additions & 0 deletions
23
packages/@vue/cli-service/generator/template/src/router.js
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,23 @@ | ||
<%_ if (options.router) { _%> | ||
import Vue from 'vue' | ||
import Router from 'vue-router' | ||
import Home from './views/Home.vue' | ||
import About from './views/About.vue' | ||
|
||
Vue.use(Router) | ||
|
||
export default new Router({ | ||
routes: [ | ||
{ | ||
path: '/', | ||
name: 'home', | ||
component: Home | ||
}, | ||
{ | ||
path: '/about', | ||
name: 'about', | ||
component: About | ||
} | ||
] | ||
}) | ||
<%_ } _%> |
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,18 @@ | ||
<%_ if (options.vuex) { _%> | ||
import Vue from 'vue' | ||
import Vuex from 'vuex' | ||
|
||
Vue.use(Vuex) | ||
|
||
export default new Vuex.Store({ | ||
state: { | ||
|
||
}, | ||
mutations: { | ||
|
||
}, | ||
actions: { | ||
|
||
} | ||
}) | ||
<%_ } _%> |
7 changes: 7 additions & 0 deletions
7
packages/@vue/cli-service/generator/template/src/views/About.vue
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,7 @@ | ||
<%_ if (options.router) { _%> | ||
<template> | ||
<div class="about"> | ||
<h1>This is an about page</h1> | ||
</div> | ||
</template> | ||
<%_ } _%> |
20 changes: 20 additions & 0 deletions
20
packages/@vue/cli-service/generator/template/src/views/Home.vue
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,20 @@ | ||
<%_ if (options.router) { _%> | ||
<template> | ||
<div class="home"> | ||
<img src="../assets/logo.png"> | ||
<HelloWorld msg="Welcome to Your Vue.js App"/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
// @ is an alias to /src | ||
import HelloWorld from '@/components/HelloWorld.vue' | ||
export default { | ||
name: 'home', | ||
components: { | ||
HelloWorld | ||
} | ||
} | ||
</script> | ||
<%_ } _%> |
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
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
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
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,2 +1,12 @@ | ||
module.exports = cli => { | ||
cli.injectFeature({ | ||
name: 'Router', | ||
value: 'router' | ||
}) | ||
|
||
cli.onPromptComplete((answers, options) => { | ||
if (answers.features.includes('router')) { | ||
options.router = true | ||
} | ||
}) | ||
} |
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,2 +1,12 @@ | ||
module.exports = cli => { | ||
cli.injectFeature({ | ||
name: 'Vuex', | ||
value: 'vuex' | ||
}) | ||
|
||
cli.onPromptComplete((answers, options) => { | ||
if (answers.features.includes('vuex')) { | ||
options.vuex = true | ||
} | ||
}) | ||
} |
Oops, something went wrong.