mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
JS toggle class read/unread when clicking on vue component NotificationReadToggle.vue
This commit is contained in:
@@ -26,13 +26,25 @@ window.addEventListener('DOMContentLoaded', function (e) {
|
||||
buttonNoText: 'false' === el.dataset.buttonText,
|
||||
showUrl: el.dataset.showButtonUrl,
|
||||
isRead: 1 === +el.dataset.notificationCurrentIsRead,
|
||||
container: el.dataset.container
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getContainer() {
|
||||
return document.getElementById(this.container);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onMarkRead() {
|
||||
if (null !== this.getContainer) {
|
||||
this.getContainer.classList.replace('read', 'unread');
|
||||
}
|
||||
this.isRead = false;
|
||||
},
|
||||
onMarkUnread() {
|
||||
if (null !== this.getContainer) {
|
||||
this.getContainer.classList.replace('unread', 'read');
|
||||
}
|
||||
this.isRead = true;
|
||||
},
|
||||
}
|
||||
@@ -40,4 +52,4 @@ window.addEventListener('DOMContentLoaded', function (e) {
|
||||
.use(i18n)
|
||||
.mount(el);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
Reference in New Issue
Block a user