refs #1766 Introduce vue-virtual-scroll in Notifications

This commit is contained in:
AkiraFukushima 2020-10-16 00:47:54 +09:00
parent b673e4df95
commit 2c3e5ed70d
1 changed files with 18 additions and 16 deletions

View File

@ -2,22 +2,24 @@
<div id="notifications" v-shortkey="shortcutEnabled ? { next: ['j'] } : {}" @shortkey="handleKey"> <div id="notifications" v-shortkey="shortcutEnabled ? { next: ['j'] } : {}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div> <div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{ linux: ['ctrl', 'r'], mac: ['meta', 'r'] }" @shortkey="reload()"></div> <div v-shortkey="{ linux: ['ctrl', 'r'], mac: ['meta', 'r'] }" @shortkey="reload()"></div>
<transition-group name="timeline" tag="div"> <DynamicScroller :items="notifications" :min-item-size="20" class="scroller" page-mode>
<div class="notifications" v-for="message in notifications" v-bind:key="message.id"> <template v-slot="{ item, index, active }">
<notification <DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.url]" :data-index="index">
:message="message" <notification
:filter="filter" :message="item"
:focused="message.id === focusedId" :filter="filter"
:overlaid="modalOpened" :focused="item.id === focusedId"
v-on:update="updateToot" :overlaid="modalOpened"
@focusNext="focusNext" v-on:update="updateToot"
@focusPrev="focusPrev" @focusNext="focusNext"
@focusRight="focusSidebar" @focusPrev="focusPrev"
@selectNotification="focusNotification(message)" @focusRight="focusSidebar"
> @selectNotification="focusNotification(item)"
</notification> >
</div> </notification>
</transition-group> </DynamicScrollerItem>
</template>
</DynamicScroller>
<div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor"></div> <div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor"></div>
<div :class="openSideBar ? 'upper-with-side-bar' : 'upper'" v-show="!heading"> <div :class="openSideBar ? 'upper-with-side-bar' : 'upper'" v-show="!heading">
<el-button type="primary" icon="el-icon-arrow-up" @click="upper" circle> </el-button> <el-button type="primary" icon="el-icon-arrow-up" @click="upper" circle> </el-button>