ソースを参照

:recycle: forcing sort on exhibition and event routes | tweaking list loading order

tags/0.9.0
J 4年前
コミット
5a801bd7b4
2個のファイルの変更19行の追加17行の削除
  1. 5
    13
      vue-theme/src/pages/list.vue
  2. 14
    4
      vue-theme/src/router/routes.js

+ 5
- 13
vue-theme/src/pages/list.vue ファイルの表示

@@ -53,6 +53,7 @@ export default {
53 53
             return typeFromRoute(this.$route)
54 54
         },
55 55
         pType() {
56
+            if(!this.type) return
56 57
             console.log(this.type, `${convertTitleCase(this.type)}s`)
57 58
             return this.sortBy ? `${convertTitleCase(this.type.split('/')[0])}s` : `${convertTitleCase(this.type)}s`
58 59
         },
@@ -105,6 +106,8 @@ export default {
105 106
             this.$store.commit('SET_HERO', { url: null, heroType: null })
106 107
         },
107 108
         async checkAndSetHero(type) {
109
+            this.clearHero()
110
+
108 111
             if (!this['allPagesLoaded']) {
109 112
                 await this.$store.dispatch('getAllPages', { sortType: null, params: null })
110 113
             }
@@ -117,9 +120,6 @@ export default {
117 120
                 page => page.slug == type + 's',
118 121
             )[0]
119 122
 
120
-            // Clear the hero and bail
121
-            if(!page) return this.clearHero()
122
-
123 123
             let json = { url: page.featured, heroType:'image' }
124 124
             if (
125 125
                 page.hero &&
@@ -135,11 +135,6 @@ export default {
135 135
             json.text = page && page.excerpt ? page.excerpt : page.title
136 136
             this.$store.commit('SET_HERO', json)
137 137
         },
138
-        scrollTo(hashtag) {
139
-            setTimeout(() => {
140
-                location.href = hashtag
141
-            }, TIMEOUT)
142
-        },
143 138
         setIntersectionLoader() {
144 139
             console.warn('setting up intersection handler for:', this.type)
145 140
             window.removeEventListener("load", e => {}, false)
@@ -165,21 +160,18 @@ export default {
165 160
             console.log('?:', path.pop())
166 161
 
167 162
             // Always reset the page count
168
-            this.setIntersectionLoader()
169 163
             this.page = 1
170 164
             
171
-            this.clearHero()
172 165
             this.checkAndSetHero(this.type)
173 166
             
174 167
             // TODO: Track last loaded page per post type
175 168
             // Less http calls
176 169
             this.getPosts(true)
170
+
171
+            this.setIntersectionLoader()
177 172
         },
178 173
     },
179 174
     mounted() {
180
-        if (this.$route.hash) {
181
-            setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
182
-        }
183 175
         this.setIntersectionLoader()
184 176
     },
185 177
     created() {

+ 14
- 4
vue-theme/src/router/routes.js ファイルの表示

@@ -29,6 +29,16 @@ export default [
29 29
         component: listPage,
30 30
         props: { sidebar: true, grid: true, sortBy: `${sortTypes.material}` },
31 31
     },
32
+    {
33
+        path: `/event`,
34
+        component: listPage,
35
+        props: { sidebar: true, sortBy: `${sortTypes.currentAndUpcoming}` },
36
+    },
37
+    {
38
+        path: `/exhibition`,
39
+        component: listPage,
40
+        props: { sidebar: true, sortBy: `${sortTypes.currentAndUpcoming}` },
41
+    },
32 42
     {
33 43
         path: `/:type/${sortTypes.past}`,
34 44
         component: listPage,
@@ -60,14 +70,14 @@ export default [
60 70
         props: { sidebar: true, sortBy: `${sortTypes.material}` },
61 71
     },
62 72
     {
63
-        path: '/:type/by-episode',
73
+        path: `/:type/${sortTypes.episode}`,
64 74
         component: listPage,
65
-        props: { sidebar: true, sortBy: 'by-episode' },
75
+        props: { sidebar: true, sortBy: `${sortTypes.episode}` },
66 76
     },
67 77
     {
68
-        path: '/:type/by-artist',
78
+        path: `/:type/${sortTypes.artist}`,
69 79
         component: listPage,
70
-        props: { sidebar: true, sortBy: 'by-artist' },
80
+        props: { sidebar: true, sortBy: `${sortTypes.artist}` },
71 81
     },
72 82
     {
73 83
         path: '/:type',

読み込み中…
キャンセル
保存