-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathExampleTransition.vue
46 lines (43 loc) · 943 Bytes
/
ExampleTransition.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
<script setup lang="ts">
import { ref } from 'vue'
import {
VueScrollPicker,
VueScrollPickerOption,
VueScrollPickerValue,
} from 'vue-scroll-picker'
import CurrentValue from './CurrentValue.vue'
defineProps<{
options: VueScrollPickerOption[]
}>()
const currentValue = ref<VueScrollPickerValue>(null)
const isVisible = ref(false)
</script>
<template>
<div>
<div class="controller">
<CurrentValue :value="currentValue" />
<div class="button-group">
<a class="button" @click="isVisible = !isVisible">{{
isVisible ? 'Hide' : 'Show'
}}</a>
</div>
</div>
<transition name="fade">
<VueScrollPicker
v-if="isVisible"
v-model="currentValue"
:options="options"
/>
</transition>
</div>
</template>
<style scoped>
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>