scroll item list to top when feed is changed

This commit is contained in:
Nazar Kanaev 2020-09-09 20:59:43 +01:00
parent b51408880b
commit 7e6ae1311e
2 changed files with 4 additions and 4 deletions

View File

@ -149,7 +149,7 @@
<span class="icon">{% inline "check.svg" %}</span>
</button>
</div>
<div class="p-2 overflow-auto border-top" v-scroll="loadMoreItems">
<div class="p-2 overflow-auto border-top" v-scroll="loadMoreItems" ref="itemlist">
<label v-for="item in items" :key="item.id"
class="selectgroup">
<input type="radio" name="item" :value="item.id" v-model="itemSelected">

View File

@ -240,6 +240,7 @@ var vm = new Vue({
if (oldVal === null) return // do nothing, initial setup
api.settings.update({feed: newVal}).then(this.refreshItems.bind(this))
this.itemSelected = null
if (this.$refs.itemlist) this.$refs.itemlist.scrollTop = 0
},
'itemSelected': function(newVal, oldVal) {
this.itemSelectedReadability = ''
@ -247,9 +248,8 @@ var vm = new Vue({
this.itemSelectedDetails = null
return
}
if (this.$refs.content) {
this.$refs.content.scrollTop = 0
}
if (this.$refs.content) this.$refs.content.scrollTop = 0
this.itemSelectedDetails = this.itemsById[newVal]
if (this.itemSelectedDetails.status == 'unread') {
this.itemSelectedDetails.status = 'read'