瀏覽代碼

:recycle: adjusting hero loading | always showing hero temporarily

tags/0.9.0
j 4 年之前
父節點
當前提交
416bd68b17
共有 3 個檔案被更改,包括 13 行新增6 行删除
  1. 1
    0
      vue-theme/src/components/card.vue
  2. 5
    5
      vue-theme/src/components/hero.vue
  3. 7
    1
      vue-theme/src/store/index.js

+ 1
- 0
vue-theme/src/components/card.vue 查看文件

@@ -10,6 +10,7 @@
10 10
         .f-col.w-max
11 11
             router-link(:to="`/${type}/${content.slug}`")
12 12
                 h1.t-up.t-cntr.t-b {{ content.title }}
13
+            p(v-if="content.end") {{ content.start }} – {{ content.end }}
13 14
             p {{ content.excerpt }}
14 15
 </template>
15 16
 

+ 5
- 5
vue-theme/src/components/hero.vue 查看文件

@@ -1,6 +1,5 @@
1 1
 <template lang="pug">
2
-.hero.w-max.f-col(v-if="showHero")
3
-    //- .tint.z-top.w-max
2
+.hero.w-max.f-col(v-if="showHero && !loading")
4 3
     .tint.w-max
5 4
     .hero--video.w-max(v-if="heroType === 'video'")
6 5
         iframe(
@@ -23,8 +22,9 @@
23 22
     .hero--image(v-else)
24 23
         .hero--image--overlay.w-max.f-col
25 24
             div(v-html="heroText")
26
-    //- if not hero image then heading overlay to show only in main article
27
-
25
+.hero.w-max.f-col(v-else-if="loading" style="justify-content: center !important;")
26
+    .tint.w-max
27
+    p loading...
28 28
 </template>
29 29
 
30 30
 <script>
@@ -42,6 +42,7 @@ export default {
42 42
         ...mapState({
43 43
             showHero: state => state.hero.url,
44 44
             heroText: state => state.hero.text,
45
+            loading: state => state.loading,
45 46
             heroType: state => state.hero.type,
46 47
             showPlaybutton: state => state.hero.playbutton,
47 48
         }),
@@ -158,5 +159,4 @@ export default {
158 159
         min-height: 50vh
159 160
         .embedded
160 161
             min-height: 50vh
161
-    
162 162
 </style>

+ 7
- 1
vue-theme/src/store/index.js 查看文件

@@ -20,6 +20,7 @@ const debug = process.env.NODE_ENV !== 'production'
20 20
 // Current page state
21 21
 const state = {
22 22
     title: wp.site_name,
23
+    loading: true,
23 24
     hero: {
24 25
         url: null,
25 26
         type: null,
@@ -32,7 +33,10 @@ const state = {
32 33
 
33 34
 const mutations = {
34 35
     SET_HERO(state, hero) {
35
-        if (!hero) return
36
+        if (!hero) {
37
+            state.loading = false
38
+            return
39
+        }
36 40
 
37 41
         if (hero.url) {
38 42
             state.hero.text = hero.text
@@ -47,8 +51,10 @@ const mutations = {
47 51
             state.hero.text = ''
48 52
             state.hero.playbutton = false
49 53
         }
54
+        state.loading = false
50 55
     },
51 56
     CLEAR_HERO(state) {
57
+        state.loading = true
52 58
         state.hero = {
53 59
             url: null,
54 60
             type: null,

Loading…
取消
儲存