javascript - The data component returned by axios request cannot be bound and rendered
扔个三星炸死你
扔个三星炸死你 2017-07-05 10:58:40
0
2
852

The data I requested from the interface is assigned to the empty object wholedata defined in data. Writing a label loop on the page can traverse the data, but the data given to the component cannot be rendered. I added <li v-for='item in wholedata.materials.opt'></li>, the data will be output, but the error still exists. If you don't add this, the data will not be output. If you add v-if='wholedata', the data will not be output, because the initial output is a Empty object
Please ask for guidance! ! !

扔个三星炸死你
扔个三星炸死你

reply all(2)
世界只因有你

Just modify the initial data format in data.

data () {
  return {
    wholedata: {
      materials: {
        opt: []
      }
    }
  }
}

As long as the properties of the object are defined initially, Vue can detect data changes. You can also traverse the data directly in the form of v-for item in x.y.z.

洪涛

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!