enrecipes/app/components/GroceryList.vue

58 lines
1.4 KiB
Vue
Raw Normal View History

2021-01-13 05:02:48 +00:00
<template>
2021-02-28 15:10:26 +00:00
<Page @loaded="onPageLoad">
<ActionBar flat="true">
<GridLayout rows="*" columns="auto, *, auto">
2021-04-01 10:55:35 +00:00
<Button class="ico left" :text="icon.back" @tap="$navigateBack()" />
2021-03-23 06:16:25 +00:00
<Label class="title tb" :text="'grocery' | L" col="1" />
2021-04-01 10:55:35 +00:00
<Button class="ico left" :text="icon.today" col="2" />
2021-02-28 15:10:26 +00:00
</GridLayout>
</ActionBar>
<GridLayout columns="" rows=""> </GridLayout>
</Page>
2021-01-13 05:02:48 +00:00
</template>
<script>
2021-02-28 15:10:26 +00:00
import { ApplicationSettings, Observable } from "@nativescript/core";
import { mapState, mapActions } from "vuex";
2021-01-13 05:02:48 +00:00
export default {
data() {
return {
appTheme: "Light",
2021-02-28 15:10:26 +00:00
};
2021-01-13 05:02:48 +00:00
},
computed: {
2021-02-28 15:10:26 +00:00
...mapState(["icon", "recipes", "mealPlans"]),
2021-01-13 05:02:48 +00:00
isLightMode() {
2021-02-28 15:10:26 +00:00
return this.appTheme === "Light";
2021-01-13 05:02:48 +00:00
},
},
methods: {
2021-04-01 10:55:35 +00:00
...mapActions(["setComponent"]),
2021-02-28 15:10:26 +00:00
onPageLoad(args) {
2021-01-13 05:02:48 +00:00
const page = args.object;
page.bindingContext = new Observable();
2021-04-01 10:55:35 +00:00
this.setComponent("GroceryList");
2021-01-13 05:02:48 +00:00
},
// HELPERS
// NAVIGATION HANDLERS
2021-02-28 15:10:26 +00:00
viewRecipe(recipeID) {
let recipe = this.recipes.filter((e) => e.id === recipeID)[0];
if (recipe) {
this.$navigateTo(ViewRecipe, {
2021-01-13 05:02:48 +00:00
props: {
filterTrylater: true,
recipeID,
},
backstackVisible: false,
2021-02-28 15:10:26 +00:00
});
2021-01-13 05:02:48 +00:00
}
},
// DATA HANDLERS
},
created() {
2021-02-28 15:10:26 +00:00
this.appTheme = ApplicationSettings.getString("appTheme", "Light");
2021-01-13 05:02:48 +00:00
},
2021-02-28 15:10:26 +00:00
};
2021-01-13 05:02:48 +00:00
</script>