mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 15:05:59 +08:00
Only show notification icon when there's at least 1 notification. Only show "load more" when there's more 🙄
This commit is contained in:
parent
1e03f26cfa
commit
3c6d137bf1
|
@ -57,7 +57,8 @@
|
|||
notifications: [],
|
||||
page: 0,
|
||||
loading: true,
|
||||
canLoadMore: true
|
||||
canLoadMore: false,
|
||||
showNotification: false,
|
||||
},
|
||||
computed: {
|
||||
has_non_read_notification: function () {
|
||||
|
@ -94,8 +95,8 @@
|
|||
});
|
||||
if (res.ok) {
|
||||
let json = await res.json();
|
||||
if (json.length == 0) that.canLoadMore = false;
|
||||
that.notifications = that.notifications.concat(json);
|
||||
that.canLoadMore = json.more;
|
||||
that.notifications = that.notifications.concat(json.notifications);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,8 +111,11 @@
|
|||
});
|
||||
if (res.ok) {
|
||||
let json = await res.json();
|
||||
that.notifications = json;
|
||||
that.notifications = json.notifications;
|
||||
that.loading = false;
|
||||
that.canLoadMore = json.more
|
||||
if (that.notifications.length > 0)
|
||||
that.showNotification = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="notification-app" class="dropdown d-none d-md-flex">
|
||||
|
||||
<div id="notification-app" class="dropdown d-none d-md-flex" v-if="showNotification">
|
||||
<a class="nav-link icon" data-toggle="collapse" href="#notifications" style="height: 100%">
|
||||
<i class="fe fe-bell"></i>
|
||||
<span v-if="has_non_read_notification" class="nav-unread"></span>
|
||||
|
|
Loading…
Reference in a new issue