Newer
Older
<script>
export default {
name: 'courseware-companion-box',
render(createElement) {
return null;
},
props: {
msgCompanion: String,
mood: {
type: String,
default: 'default',
validator: value => {
return ['default','unsure', 'special', 'sad', 'pointing', 'curious'].includes(value);
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
computed: {
msgType() {
let type = 'info';
switch (this.mood) {
case 'special':
case 'unsure':
type = 'warning';
break;
case 'sad':
type = 'error';
break;
case 'happy':
type = 'success';
break
case 'pointing':
case 'curious':
}
return type;
}
},
watch: {
msgCompanion: {
handler(current) {
if (current.trim().length === 0) {
return;
}
const notification = {
type: this.msgType,
message: current
};
this.globalEmit('push-system-notification', notification);
},
immediate: true
}
}