mardi 30 janvier 2018

Push a new object on specific index of an array using vue.js

**I want to add multiple check and folder on and similar under folder 3. I want to create nested array. I tried to use push but i dont know how to push array on specific index. **

new Vue({
      el: '#sample',
      data: {
option:{
name:'',
url:'',
type:''},
        private: {
          folders : [{
              name : 'folder1',
              checks : [
                { 
                 name : '',
                 url:'',
                 type:'' 
                },

              ]
            },
            {
              name : 'folder2',
               checks : [
                { 
                 name : '',
                 url:'',
                 type:'' 
                },
              ]
            }
          ]
        }
      }
    })

I want to push **option array into check and folder1 and slimier to folder 2 gain the result like**

      new Vue({
          el: '#sample',
          data: {
            private: {
              folders : [{
                  name : 'folder1',
                  checks : [
                   /*check 1*/ { 
                     name : '',
                     url:'',
                     type:'' 
                    },
/*check 2*/
                   { 
                     name : '',
                     url:'',
                     type:'' 
                    }
                  { 
                     name : '',
                     url:'',
                     type:'' 
                    }

                  ]
                },
                {
                  name : 'folder2',
                  checks : [
                   checks : [
                    { 
                     name : '',
                     url:'',
                     type:'' 
                    },
                  ]
                }
              ]
            }
          }
        })

Is there any one who can help i want to write and function and



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire