-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
BottomSheet.vue
62 lines (59 loc) · 2.17 KB
/
BottomSheet.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
60
61
62
<template>
<Page>
<ActionBar :title="title">
<NavigationButton text="Back" android.systemIcon="ic_menu_back" @tap="onNavigationButtonTap"></NavigationButton>
</ActionBar>
<StackLayout>
<MDButton id="bottomsheet" text="bottomsheet" @tap="onTap" />
<MDButton id="bottomsheet-keyboard" text="bottomsheet-keyboard" @tap="onTap" />
</StackLayout>
</Page>
</template>
<script lang="ts">
import * as frameModule from '@nativescript/core/ui/frame';
import Vue from 'vue';
import { EventData, View, Color } from '@nativescript/core/ui/frame';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout/stack-layout';
import { ActivityIndicator } from '@nativescript/core/ui/activity-indicator/activity-indicator';
import { Label } from '@nativescript/core/ui/label/label';
import BottomSheetInner from './BottomSheetInner.vue';
import BottomSheetInnerKeyboard from './BottomSheetInnerKeyboard.vue';
import { NativeScriptVue } from 'nativescript-vue';
export const title = 'BottomSheet sample';
export default Vue.extend({
data() {
return {
name: 'BottomSheet',
title: title
};
},
methods: {
onNavigationButtonTap() {
frameModule.topmost().goBack();
},
onTap(args: EventData) {
const obj = args.object as View;
const objId = obj.id;
console.log('onTap', objId, obj);
switch (objId) {
case 'bottomsheet': {
(this as NativeScriptVue).$showBottomSheet(BottomSheetInner, {
closeCallback: objId => {
console.log('bottom sheet closed');
}
});
break;
}
case 'bottomsheet-keyboard': {
(this as NativeScriptVue).$showBottomSheet(BottomSheetInnerKeyboard, {
closeCallback: objId => {
console.log('bottom sheet closed');
}
});
break;
}
}
}
}
});
</script>