Raido
1285
2
Vue

how to combine arrays in Vue?

Posted 2 years ago by Raido

I am learning and my mission is to create reusable table component.

Two arrays-> One fetching data from table and another receiving column names and table fields. But I am faced with question - is there a way to combine it in Vue so that I could have something like

'{{tablevalue.theader.columnname}}'

All comments and explanations how to improve code and have a field with a desired value are appreciated.

My html

'''

something

'''

My Vue component

'''

{{theader.columnname}} ????

export default{

props: {tablename:''},


data() {
       
        return {
            tableRequested:[],
            tableContent:[],

    };
    
},

created(){
    this.tableRequested = this.$children;
    this.getContent();

},


mounted() {

},

methods: {

    getContent: function(){
        axios.get('api/'+this.tablename)
        .then(response => this.tableContent = response.data);
    },

},

computed: {

    
},

}

'''

and child component

'''

export default{

props:{
    columnname:'',
    retrievefield:'',

},

data() {

    return{

    };
},


mounted() {

     console.log(this.$children)


},


methods: {

},

computed: {

    
},

}

'''

Please sign in or create an account to participate in this conversation.