电影信息(使用父传子组件)

app.vue

<template>
  <div>
    <meituan :arr="list"></meituan>
  </div>
</template>


<script>
import meituan from './components/meituan.vue'
export default {
  components: { meituan },
  data(){
    return{
      list:[
        {id:1,img:'https://p0.pipi.cn/mmdb/25bfd65133951bd7c350c83d1c59b6c75a0cb.jpg?imageMogr2/thumbnail/2500x2500%3E',score:9.1,name:'哥,你好'},
        {id:2,img:'https://p0.pipi.cn/mmdb/25bfd6ddb53c7e5015d23c5bc24d876c03d41.jpg?imageMogr2/thumbnail/2500x2500%3E',score:9.6,name:'万里归途'},
        {id:3,img:'https://p0.pipi.cn/mmdb/25bfd6ddbe1c7ecbaec7edee785c42fbcc785.jpg?imageMogr2/thumbnail/2500x2500%3E',score:9.2,name:'独行月球'},
        {id:4,img:'https://p0.pipi.cn/mmdb/25bfd65187a923be12b8607870b84d901af50.jpg?imageMogr2/thumbnail/2500x2500%3E',score:9.3,name:'新大头儿子'},
        {id:5,img:'https://p0.pipi.cn/mmdb/25bfd6ddb53338925739ddde572ed1be162d4.jpg?imageMogr2/thumbnail/2500x2500%3E',score:9.2,name:'平凡英雄'},


      ]
    }
  }
}
</script>


<style>


</style>

meituan.vue(组件)

<template>
  <header>
    <div v-for="obj in arr" :key="obj.id" class="a">
      <img :src=obj.img >
      <div>
        <h6>观众评 <font> {{obj.score}}</font></h6>
        <p>{{obj.name}}<button class="btn btn-danger btn-sm">购票</button></p>
      </div>
    </div>
  </header>
</template>


<script>
export default {
  props:["arr"]
}
</script>


<style>


  img{
    width: 200px;
  }
  div{
    float: left;
    margin: 10px;
    position: relative;
  }
  div>div{
    left: -10px;
    width: 100%;
    position: absolute;
    bottom: -10px;
    color: pink;
    background-color: rgba(1, 1, 1, 0.5);
    
  }
  div>h6{
    
    font-size:12px;
    margin: 0;
    color: rgb(230, 217, 217);
    margin-left: 10px;
    font-weight: bold;
    
  }
  div>p{
    font-size: 15px;
    margin-bottom: 8px;
    margin-top: 2px;
    color: rgb(230, 217, 217);
    margin-left: 10px;
  }
  font{
    font-size: 15px;
    color: rgb(216, 119, 15);
    font-weight: normal;
  }


  div .btn{
    float: right;
    padding: 1px 6px 1.5px 6px;
    position: absolute;
    right: 0;
    bottom: 8px;
    font-size: 14px;
    border-radius: 100px;
  }
  .a:hover{
    transform: scale(1.05);
  }
</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值