ember flash notifications
v0.1.4
Addon dirancang untuk menampilkan pemberitahuan flash dalam aplikasi Ember.js. Didukung oleh Popover API.
ember install ember-flash-notifications
Tambahkan doa flashnotifications ke templat:
<FlashNotifications as |notification|>
<FlashNotification @notification={{notification}}>
<div class={{notification.type}}>{{notification.message}}</div>
</FlashNotification>
</FlashNotifications>
Tambahkan gaya minimal yang diperlukan untuk elemen pemberitahuan (tailwindCSS bukan ketergantungan, dan Anda juga dapat menggunakan CSS biasa):
[popover] {
@apply my-0 mr-0;
}
.flash {
@apply w-80 border transition-opacity block opacity-0;
}
.flash:popover-open {
@apply opacity-100;
}
.flash .error {
@apply bg-rose-500 text-white p-2 rounded-sm;
}
@starting-style {
.flash:popover-open {
@apply opacity-0;
}
}
... dan membuat doa pemberitahuan:
mport { action } from '@ember/object';
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class FlashComponent extends Component {
@service notifications;
@action
addNotification() {
this.notifications.error('Something is going wrong!');
}
}
Lihat contoh terperinci, dokumen API dan contoh langsung di sini
Lihat panduan yang berkontribusi untuk detailnya.
Proyek ini dilisensikan di bawah lisensi MIT.