Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solving one root error in TransactionList.vue and CreateUpdateBudget.vue #7

Open
azcvcza opened this issue Jun 4, 2019 · 1 comment

Comments

@azcvcza
Copy link

azcvcza commented Jun 4, 2019

maybe the tutorial's version of vue is somehow low.2 Template in one single .vue file is not allowed
so you can try this solution
in CreateUpdateBudget.vue
-old

<template v-for="(value, key) in selectedBudget.budgetCategories">
<component
              :is="budgetCategoryComponent(value)"
              v-model="value"
              v-on:update-budget-category="saveBudgetCategory"
              v-on:edit-budget-category="activeBudgetCategory = value">
</component>
</template>

-new

<BudgetCategory
		v-for="(value, key) in selectedBudget.budgetCategories"
	        :is="budgetCategoryComponent(value)"
		:key="key"
		:BudgetCategoryValue="value"<!-- here i change prop alias from :value to :BudgetCategoryVaule-->
		v-on:update-budget-category="saveBudgetCategory"
		v-on:edit-budget-category="activeBudgetCategory = value">
</BudgetCategory>
<script>
import BudgetCategory from './BudgetCategory'
...
components: { Datepicker , CreateUpdateBudgetCategory , BudgetCategory },
...
</script>

the same goes in TransactionList.vue
-new

<Transaction
		v-for="(transaction, key) in sortedTransactions"
		:class="{ 'is-delinquent': false }"
		:is="transactionComponent(transaction)"
		:key="key"
		:TransactionValue="transaction"
		v-on:updated-transaction="activeTransaction = null"
		v-on:edit-transaction="activeTransaction = transaction">
</Transaction>

maybe my solution will be some help for who has the same problem while learning the tutorial

@azcvcza
Copy link
Author

azcvcza commented Jun 5, 2019

here is another solution using

<template>
<slot>
</slot>
</template>

https://stackoverflow.com/questions/44888268/vuejs-pass-slot-to-child-of-child-component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant