export const actions = {
async loadFunction({ commit }) {
try {
const plans = await Parse.Cloud.run('getFunction', {}, {});
commit('setFunction', plans);
} catch (error) {
commit('setFunction', null);
return null;
}
},
};
<TItem
v-for="
(index, item) in ?????
:key="index"
:tplan="item"
@delete="deleteItem(index)"
/>
// store
export const state = () => ({
functions: []
});
export const actions = {
async loadFunction({ commit }) {
try {
const plans = await Parse.Cloud.run('getFunction', {}, {});
commit('setFunction', plans);
} catch (error) {
commit('setFunction', null);
return null;
}
},
};
export const mutations = {
setFunction: (state, payload) => {
state.functions = payload;
}
}
// Ваш копонент, где вы отображаете TItem
<template>
<div>
<TItem
v-for="(item, index) in functions"
:key="index"
:tplan="item"
@delete="deleteItem(index)"
/>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
//....
computed: {
...mapState([
'functions'
])
}
//...
}
</script>