Skip to content

Commit 41f0ab5

Browse files
Move enums to enum folder, change home page using namespaced store "home".
1 parent ece540a commit 41f0ab5

File tree

21 files changed

+40
-96
lines changed

21 files changed

+40
-96
lines changed

src/components/home/feed/Feed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class Feed extends Vue {
99
private layout: number[] = [2, 2, 1, 2, 2, 3, 3, 3, 3, 3, 3];
1010
private page: number = 1;
1111

12-
@namespace('app').State('articles') articles!: IArticle[];
12+
@namespace('home').State('articles') articles!: IArticle[];
1313

1414
get pages() {
1515
return Math.ceil(this.articles.length / 11);

src/components/home/newest_posts/NewestPosts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { IArticle } from '@/data/articles';
44

55
@Component({})
66
export default class NewestPosts extends Vue {
7-
@namespace('app').State('articles') articles!: IArticle[];
7+
@namespace('home').State('articles') articles!: IArticle[];
88
};

src/components/home/tags/Tags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { namespace, State, Getter } from 'vuex-class';
33

44
@Component({})
55
export default class Tags extends Vue {
6-
@namespace('app').Getter('categories') categories!: any;
6+
@namespace('home').Getter('categories') categories!: any;
77
};

src/enums/iconType.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// You can refer to this
2+
// https://materialdesignicons.com/
3+
enum IconType {
4+
Person = 'person',
5+
Lock = 'lock'
6+
}
7+
8+
export default IconType;

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Vue from 'vue';
22
import App from './App.vue';
33
import router from './plugins/router';
4-
import vuetify from './plugins/vuetify/vuetify';
4+
import vuetify from './plugins/vuetify';
55
import store from './plugins/store';
6-
import './plugins/base_components/baseComponents';
6+
import './plugins/global-components';
77

88
Vue.config.productionTip = false;
99

src/pages/generic/drawer/Drawer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { namespace, State, Getter, Mutation } from 'vuex-class';
33

44
@Component({ name: 'CoreDrawer' })
55
export default class Drawer extends Vue {
6-
@namespace('app').Getter('links') links: any;
7-
@namespace('app').State('drawer') drawer: any;
8-
@namespace('app').Mutation('setDrawer') setDrawer: any;
6+
@namespace('home').Getter('links') links: any;
7+
@namespace('home').State('drawer') drawer: any;
8+
@namespace('home').Mutation('setDrawer') setDrawer: any;
99

1010
private onClickListItem(e: any, item: any) {
1111
e.stopPropagation();

src/pages/generic/nav_bar/NavBar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, Vue, Prop, Watch, Emit } from 'vue-property-decorator';
2-
import { IconType } from '@/utils/enums';
2+
import IconType from '@/enums/iconType';
33

44
@Component({})
55
export default class NavBar extends Vue {

src/pages/generic/toolbar/Toolbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { namespace, State, Getter, Mutation } from 'vuex-class';
33

44
@Component({})
55
export default class Toolbar extends Vue {
6-
@namespace('app').Getter('links') links!: any;
7-
@namespace('app').Mutation('toggleDrawer') toggleDrawer!: any;
6+
@namespace('home').Getter('links') links!: any;
7+
@namespace('home').Mutation('toggleDrawer') toggleDrawer!: any;
88

99
private onClickButton(e: Event, item: any) {
1010
e.stopPropagation();

src/plugins/store/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import Vue from 'vue';
22
import Vuex, { StoreOptions } from 'vuex';
33
import app from './modules/app';
4+
import home from './modules/home';
45

56
// register VUEX
67
Vue.use(Vuex);
78

9+
export interface State {
10+
[key: string]: any
11+
}
12+
813
let opt: StoreOptions < any > = {
914
// strict mode
1015
strict: true,
1116

1217
// module states
13-
modules: { app },
18+
modules: { app, home },
1419

1520
// root states
1621
state: {},

0 commit comments

Comments
 (0)