dnet45/modules/uoa-repository-dashboard-gui/trunk/src/public/js/core/alert.js @ 46812
1 |
import { Class, Toggable } from '../mixin/index'; |
---|---|
2 |
|
3 |
export default function (UIkit) { |
4 |
|
5 |
UIkit.component('alert', { |
6 |
|
7 |
mixins: [Class, Toggable], |
8 |
|
9 |
args: 'animation', |
10 |
|
11 |
props: { |
12 |
close: String |
13 |
},
|
14 |
|
15 |
defaults: { |
16 |
animation: [true], |
17 |
close: '.uk-alert-close', |
18 |
duration: 150, |
19 |
hideProps: {opacity: 0} |
20 |
},
|
21 |
|
22 |
events: [ |
23 |
|
24 |
{
|
25 |
|
26 |
name: 'click', |
27 |
|
28 |
delegate() { |
29 |
return this.close; |
30 |
},
|
31 |
|
32 |
handler(e) { |
33 |
e.preventDefault(); |
34 |
this.closeAlert(); |
35 |
}
|
36 |
|
37 |
}
|
38 |
|
39 |
],
|
40 |
|
41 |
methods: { |
42 |
|
43 |
closeAlert() { |
44 |
this.toggleElement(this.$el).then(() => this.$destroy(true)); |
45 |
}
|
46 |
|
47 |
}
|
48 |
|
49 |
});
|
50 |
|
51 |
}
|