-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
/
prop-closable.vue
59 lines (52 loc) 路 1.33 KB
/
prop-closable.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
<div>
<v-alert
v-model="alert"
border="start"
variant="tonal"
closable
close-label="Close Alert"
color="deep-purple-accent-4"
title="Closable Alert"
>
Aenean imperdiet. Quisque id odio. Cras dapibus. Pellentesque ut neque. Cras dapibus.
Vivamus consectetuer hendrerit lacus. Sed mollis, eros et ultrices tempus, mauris ipsum aliquam libero, non adipiscing dolor urna a orci. Sed mollis, eros et ultrices tempus, mauris ipsum aliquam libero, non adipiscing dolor urna a orci. Curabitur blandit mollis lacus. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo.
</v-alert>
<div
v-if="!alert"
class="text-center"
>
<v-btn
@click="alert = true"
>
Reset
</v-btn>
</div>
</div>
</template>
<script setup>
import { computed, ref } from 'vue'
const alert = ref(true)
const alertText = computed(() => alert.value ? 'Reset' : 'Show Alert')
function reset () {
alert.value = true
}
</script>
<script>
export default {
data: () => ({
alert: true,
alertText: 'Reset',
}),
computed: {
alertText () {
return this.alert ? 'Reset' : 'Show Alert'
},
},
methods: {
reset () {
this.alert = true
},
},
}
</script>