Explorar el Código

Add loading placeholder

sbkwgh hace 8 años
padre
commit
6aa10e9751
Se han modificado 2 ficheros con 10 adiciones y 0 borrados
  1. 6 0
      src/components/routes/Thread.vue
  2. 4 0
      src/store/modules/thread.js

+ 6 - 0
src/components/routes/Thread.vue

@@ -81,6 +81,12 @@
 				@loadNext='loadNextPosts'
 				@loadPrevious='loadPreviousPosts'
 			>
+				<thread-post-placeholder
+					v-if='!posts.length'
+					v-for='n in 3'
+					:class='{"post--last": n === 2}'
+				></thread-post-placeholder>
+
 				<thread-post-placeholder
 					v-if='$store.state.thread.loadingPosts === "previous"'
 					v-for='n in $store.state.thread.previousPostsCount'

+ 4 - 0
src/store/modules/thread.js

@@ -101,6 +101,10 @@ const actions = {
 			})
 	},
 	loadInitialPostsAsync ({ state, commit, dispatch, rootState }, vue) {
+		commit('setPosts', [])
+		commit('setThread', { name: 'Loading...' })
+		dispatch('setTitle', 'Loading...')
+
 		let postNumber = vue.$route.params.post_number
 		let apiURL = '/api/v1/thread/' + vue.$route.params.id