-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
Hello.vue
36 lines (35 loc) · 831 Bytes
/
Hello.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!-- Hello.vue -->
<template>
<div>
<div>
<!-- !!!!! expected error !!!!! -->
Hello {{ (name as any) }}{{exclamationMarks}}
</div>
<button @click="decrement">-</button>
<button @click="increment">+</button>
</div>
</template>
<script lang="ts">
import Vue from "vue";
export default Vue.extend({
props: ['name', 'initialEnthusiasm'],
data() {
return {
enthusiasm: this.initialEnthusiasm,
}
},
methods: {
increment() { this.enthusiasm++; },
decrement() {
if (this.enthusiasm > 1) {
this.enthusiasm--;
}
},
},
computed: {
exclamationMarks(): any { // !!!!! expected error !!!!!
return Array(this.enthusiasm + 1).join('!');
}
}
});
</script>