Skip to content

Commit 8ccbbcf

Browse files
committed
+ Update to @vert/core 1.0.
1 parent 843dc4f commit 8ccbbcf

File tree

8 files changed

+2471
-2481
lines changed

8 files changed

+2471
-2481
lines changed

client/app.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { App, Injector } from '@vert/core'
1+
import { App } from '@vert/core'
22
import Vue from 'vue'
33
import VueRouter from 'vue-router'
44
import Vuex from 'vuex'
55
import { sync } from 'vuex-router-sync'
66

7-
import RootComponent from './root-component.vue'
7+
import Layout from './layout/index.vue'
88
import { createRouter } from './router'
99
import { createStore } from './store'
1010

@@ -20,13 +20,7 @@ function initVue () {
2020
}
2121

2222
function initService () {
23-
const Services = [
24-
GreetingService, UserService
25-
]
26-
const injector = Injector.create(...Services)
27-
Services.forEach((Service: any) => {
28-
App.addSingleton(Service, injector.get(Service))
29-
})
23+
App.addSingleton(GreetingService, UserService)
3024
}
3125

3226
function createApp () {
@@ -38,9 +32,7 @@ function createApp () {
3832
const app = new Vue({
3933
router,
4034
store,
41-
render (h) {
42-
return h(RootComponent)
43-
}
35+
render: h => h(Layout)
4436
})
4537

4638
return {

client/layout/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Component } from '@vert/core'
2+
import Vue from 'vue'
3+
4+
@Component
5+
export default class RootComponent extends Vue {
6+
}

client/root-component.vue renamed to client/layout/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
router-view
44
</template>
55

6-
<script lang="ts" src="./root-component.ts"></script>
6+
<script lang="ts" src="./index.ts"></script>

client/page/about/index.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { AppComponent, Component } from '@vert/core'
1+
import { Component } from '@vert/core'
2+
import Vue from 'vue'
23

34
@Component
4-
export default class AboutPage extends AppComponent {
5+
export default class AboutPage extends Vue {
56
private isLoading: boolean = false
67

78
async asyncData ({ store, route }) {
89
console.log('AsyncData in about page is called.')
9-
10-
await sleep(1000)
1110
await store.dispatch(
1211
'about/setOldSaying',
1312
`${route.params.name}: The quick brown fox jumps over the lazy dog.`
@@ -24,9 +23,3 @@ export default class AboutPage extends AppComponent {
2423
this.$store.dispatch('about/setOldSaying', 'Nothing but tricks.')
2524
}
2625
}
27-
28-
function sleep (time: number) {
29-
return new Promise((resolve) => {
30-
setTimeout(resolve, time)
31-
})
32-
}

client/page/index/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { AppComponent, Component } from '@vert/core'
1+
import { Component } from '@vert/core'
2+
import Vue from 'vue'
3+
24
import { GreetingService } from '../../service/greeting'
35
import { IUser, UserService } from '../../service/user'
46

57
@Component
6-
export default class AppIndex extends AppComponent {
8+
export default class AppIndex extends Vue {
79
pageName: string = ''
810
userList: IUser[] = []
911

client/root-component.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)