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>

posted @ 2021-07-21 14:04  thomas_blog  阅读(1366)  评论(0编辑  收藏  举报