enrecipes/app/components/modal/ActionDialog.vue

59 lines
1.3 KiB
Vue
Raw Normal View History

2020-10-21 17:54:45 +00:00
<template>
<Page>
2020-10-22 18:36:50 +00:00
<StackLayout
class="dialogContainer"
:class="isLightTheme ? 'light' : 'dark'"
>
2020-10-21 17:54:45 +00:00
<Label class="dialogTitle orkm" :text="title" />
2020-10-22 18:36:50 +00:00
<ListView
width="100%"
:height="height"
for="item in list"
@itemTap="tapAction"
separatorColor="transparent"
>
<v-template>
<StackLayout class="actionItem">
<Label :text="item" />
</StackLayout>
</v-template>
</ListView>
2020-10-21 17:54:45 +00:00
<GridLayout rows="auto" columns="auto, *, auto">
<Label
v-if="action"
col="0"
class="cancel orkm pull-left"
:text="action"
@tap="$modal.close(action)"
/>
<Label
col="2"
class="cancel orkm pull-right"
text="CANCEL"
@tap="$modal.close(false)"
/>
</GridLayout>
</StackLayout>
</Page>
</template>
<script>
2020-10-22 18:36:50 +00:00
import Theme from "@nativescript/theme"
2020-10-21 17:54:45 +00:00
export default {
props: ["title", "list", "height", "action"],
2020-10-22 18:36:50 +00:00
data() {
return {
isLightTheme: true,
}
},
2020-10-21 17:54:45 +00:00
methods: {
tapAction({ item }) {
this.$modal.close(item)
},
},
2020-10-22 18:36:50 +00:00
created() {
this.isLightTheme = Theme.getMode() == "ns-light" ? true : false
},
2020-10-21 17:54:45 +00:00
}
</script>