enrecipes/app/components/Settings.vue

107 lines
2.5 KiB
Vue
Raw Normal View History

2020-09-15 11:10:16 +00:00
<template>
2021-02-28 15:10:26 +00:00
<Page @loaded="onPageLoad">
2021-03-21 17:02:04 +00:00
<ActionBar flat="true">
2021-02-28 15:10:26 +00:00
<GridLayout rows="*" columns="auto, *">
<MDButton
class="er left"
variant="text"
:text="icon.back"
automationText="Back"
@tap="$navigateBack()"
col="0"
/>
<Label class="title orkm" :text="'Settings' | L" col="1" />
2020-10-14 19:32:32 +00:00
</GridLayout>
2021-02-28 15:10:26 +00:00
</ActionBar>
2021-03-21 17:02:04 +00:00
<GridLayout rows="*" columns="*" class="main-container">
<ListView @loaded="listViewLoad" for="item in items">
<v-template>
<GridLayout
columns="auto, *"
class="option mdr"
@tap="navigateTo(item.view)"
>
2021-02-28 15:10:26 +00:00
<Label
2021-03-21 17:02:04 +00:00
col="0"
verticalAlignment="center"
class="er"
:text="icon[item.icon]"
2021-02-28 15:10:26 +00:00
/>
2021-03-21 17:02:04 +00:00
<Label verticalAlignment="center" col="1" :text="item.title | L" />
</GridLayout>
</v-template>
</ListView>
</GridLayout>
2021-02-28 15:10:26 +00:00
</Page>
2020-09-15 11:10:16 +00:00
</template>
<script>
2021-03-21 17:02:04 +00:00
import { Observable } from "@nativescript/core";
2021-02-28 15:10:26 +00:00
import { mapState, mapActions } from "vuex";
2021-03-21 17:02:04 +00:00
import Interface from "./Settings/Interface.vue";
import Options from "./Settings/Options.vue";
import Database from "./Settings/Database.vue";
import Reset from "./Settings/Reset.vue";
import Help from "./Settings/Help.vue";
import About from "./Settings/About.vue";
2020-09-15 11:10:16 +00:00
export default {
data() {
return {
2021-03-21 17:02:04 +00:00
items: [
{
icon: "theme",
title: "intf",
view: Interface,
},
{
icon: "cog",
title: "opts",
view: Options,
},
{
icon: "exp",
title: "db",
view: Database,
},
{
icon: "reset",
title: "rest",
view: Reset,
},
{
icon: "help",
title: "help",
view: Help,
},
{
icon: "info",
title: "About",
view: About,
},
],
2021-02-28 15:10:26 +00:00
};
2020-09-15 11:10:16 +00:00
},
2020-10-14 19:32:32 +00:00
computed: {
2021-03-21 17:02:04 +00:00
...mapState(["icon"]),
2020-10-14 19:32:32 +00:00
},
2020-09-15 11:10:16 +00:00
methods: {
2021-03-21 17:02:04 +00:00
...mapActions(["setCurrentComponentAction"]),
2021-02-28 15:10:26 +00:00
onPageLoad(args) {
const page = args.object;
page.bindingContext = new Observable();
2021-02-28 15:10:26 +00:00
this.setCurrentComponentAction("Settings");
2020-10-21 17:54:45 +00:00
},
2021-03-21 17:02:04 +00:00
listViewLoad(args) {
let e = args.object.android;
e.setSelector(new android.graphics.drawable.StateListDrawable());
e.setDivider(null);
e.setDividerHeight(0);
2020-09-15 11:10:16 +00:00
},
2021-03-21 17:02:04 +00:00
// HELPERS
navigateTo(view) {
this.$navigateTo(view);
2021-02-28 15:10:26 +00:00
},
2020-09-15 11:10:16 +00:00
},
2021-02-28 15:10:26 +00:00
};
2020-09-15 11:10:16 +00:00
</script>