vue获取对象个数
<script>
export default {
name: 'HelloWorld',
data() {
return {
msg: 'Welcome to Your Vue.js App',
goods: [{
src: 'girl.jpg',
link: 'http://wwww.baidu.com',
title: '女装'
},
{
src: 'girl.jpg',
link: 'http://wwww.baidu.com',
title: '女装'
},
{
src: 'girl.jpg',
link: 'http://wwww.baidu.com',
title: '女装'
},
{
src: 'girl.jpg',
link: 'http://wwww.baidu.com',
title: '女装'
},
]
}
},
mounted() {
console.log(Object.keys(this.goods).length);
}
}
</script>