您当前的位置: 首页 > 

彭世瑜

暂无认证

  • 1浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Vue:插槽属性prop的使用示例

彭世瑜 发布时间:2021-01-25 15:13:25 ,浏览量:1

插槽属性prop的使用示例

文档:https://cn.vuejs.org/v2/guide/components-slots.html

子组件


  
    
      {{item.name}}
    
  



export default {
  name: 'Child',

  props: {
    list: { type: Array },
  },
};




父组件


  
    
    

    
    
      
        {{item.name}}-{{item.age}}
      
    

    
    
      {{age}}
    
  



import Child from './Child.vue';

export default {
  name: 'App',

  components: { Child },

  data() {
    return {
      list: [
        { name: 'Tom', age: 23 },
        { name: 'Jack', age: 24 },
        { name: 'Steve', age: 25 },
      ],
    };
  },
};




显示效果

TomJackSteve
Tom-23 Jack-24 Steve-25
232425
关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.0551s