メインコンテンツまでスキップ
バージョン: 1.11.0

Notification

Overview​

Notification は、ポップアップの通知を表示します。


Specification​

Property​

使用できるプロパティの一覧です。プロパティを指定して値を更新することができます。

NameTypeDefaultDescriptionRemark
classNamestring""コンポーネントの class 名
textstring""表示するテキスト
typestring"danger"背景色以下を指定できる
"danger" : Red(#e74c3c)
"info" : Blue(#3498db)
"success" : Green(#91c36c)
durationnumber-1コンポーネントを閉じるまでのミリ秒単位はミリ秒
0以上の数値を指定できる
もし不正な値を指定した場合(0未満もしくは数値以外)、コンポーネントは開かれたまま自動的には閉じない

Event​

指定できるイベントの一覧です。

NameTypeDescriptionRemark
closefunctionコンポーネントが閉じられた時のイベントハンドラ引数には Event の event オブジェクトをとる

Constructor​

Notification(options)
使用できるコンストラクタの一覧です。

Parameter​

NameTypeDefaultDescriptionRemark
optionsobject{}コンポーネントのプロパティを含むオブジェクト

Method​

使用できるメソッドの一覧です。

open()​

Notification を表示する

Parameter​

none

Return​

none

close()​

Notification を非表示にする

Parameter​

none

Return​

none

Custom CSS​

ヒント

Custom CSS をご確認ください。

コンポーネントのスタイルを変更するために使用できるプロパティの一覧です。

Property​

Name
--kuc-notification-font-size
--kuc-notification-color
--kuc-notification-background-color
--kuc-notification-close-button-background-color

Sample Code​

ヒント

導入と実装方法 をご確認ください。

全てのパラメータを指定した場合のサンプルコードです。

const Kuc = Kucs['1.x.x'];

const notification = new Kuc.Notification({
text: 'Error occurred!',
type: 'danger',
className: 'options-class',
duration: 2000
});

notification.addEventListener('close', event => {
console.log(event);
});

notification.open();
notification.close();