Add reload button and reload home timeline
This commit is contained in:
parent
a679074d28
commit
adde49d8af
|
@ -26,7 +26,8 @@ export default {
|
|||
lazyLoading: state => state.TimelineSpace.Contents.Home.lazyLoading,
|
||||
backgroundColor: state => state.App.theme.background_color,
|
||||
heading: state => state.TimelineSpace.Contents.Home.heading,
|
||||
unread: state => state.TimelineSpace.Contents.Home.unreadTimeline
|
||||
unread: state => state.TimelineSpace.Contents.Home.unreadTimeline,
|
||||
startReload: state => state.TimelineSpace.HeaderMenu.reload
|
||||
})
|
||||
},
|
||||
mounted () {
|
||||
|
@ -47,6 +48,16 @@ export default {
|
|||
document.getElementById('scrollable').scrollTop = 0
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
startReload: function (newState, oldState) {
|
||||
if (!oldState && newState) {
|
||||
this.reload()
|
||||
.finally(() => {
|
||||
this.$store.commit('TimelineSpace/HeaderMenu/changeReload', false)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onScroll (event) {
|
||||
// for lazyLoading
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
<div id="header_menu">
|
||||
<div class="channel">{{ title }}</div>
|
||||
<div class="tools">
|
||||
<el-button type="text" class="toot" @click="openNewTootModal">
|
||||
<el-button type="text" class="action" @click="openNewTootModal">
|
||||
<icon name="regular/edit"></icon>
|
||||
</el-button>
|
||||
<el-button type="text" class="action" @click="reload">
|
||||
<icon name="sync-alt"></icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -71,6 +74,9 @@ export default {
|
|||
},
|
||||
openNewTootModal () {
|
||||
this.$store.dispatch('TimelineSpace/Modals/NewToot/openModal')
|
||||
},
|
||||
reload () {
|
||||
this.$store.commit('TimelineSpace/HeaderMenu/changeReload', true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +100,7 @@ export default {
|
|||
.tools {
|
||||
font-size: 18px;
|
||||
|
||||
.toot {
|
||||
.action {
|
||||
color: var(--theme-secondary-color);
|
||||
padding: 0;
|
||||
|
||||
|
|
|
@ -3,11 +3,15 @@ import Mastodon from 'megalodon'
|
|||
const HeaderMenu = {
|
||||
namespaced: true,
|
||||
state: {
|
||||
title: 'Home'
|
||||
title: 'Home',
|
||||
reload: false
|
||||
},
|
||||
mutations: {
|
||||
updateTitle (state, title) {
|
||||
state.title = title
|
||||
},
|
||||
changeReload (state, value) {
|
||||
state.reload = value
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
Loading…
Reference in New Issue