zoukankan      html  css  js  c++  java
  • vue五十:Vue美团项目之商家详情-查看商品详情

    查看商品详情

    获取商品数据

    商品详情页面,写成自定义组件

    控制点击商品再展示

    详情页和布局

    关闭按钮点击事件

    <style scoped lang="scss">
    .gd-container {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    .middle-box {
    315px;
    height: 440px;
    position: relative;
    .goods-detail {
    border-radius: 10px;
    overflow: hidden;
    height: 348px;
    background-color: #fff;
    padding: 10px;
    .picture {
    100%;
    height: 236px;
    }
    .month-sale {
    font-size: 12px;
    margin-top: 10px;
    }
    .intro {
    font-size: 14px;
    margin-top: 10px;
    height: 40px;
    }
    .price {
    margin-top: 10px;
    font-size: 18px;
    color: #fb4e44;
    }
    }
    .close-btn {
    40px;
    height: 40px;
    background-image: url("http://s3plus.meituan.net/v1/mss_e2821d7f0cfe4ac1bf9202ecf9590e67/cdn-prod/file:9096d347/df125964473c5a2c4edadb74d8a11995.png");
    background-size: 40px;
    background-position: center;
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    margin-left: -20px;
    }
    }
    }
    </style>
    <template>
    <div class="gd-container" v-show="show">
    <div class="middle-box">
    <div class="goods-detail">
    <img :src="goods.picture" alt="" class="picture">
    <div class="month-sale">月售10份</div>
    <div class="intro">{{goods.intro}}</div>
    <div class="price">¥{{goods.price}}</div>
    </div>
    <div class="close-btn" @click="closeClick">

    </div>
    </div>
    </div>
    </template>


    <script type="text/ecmascript-6">
    export default {
    name: "goods-detail",
    props: ['goods'],
    data() {
    return {
    show: false
    }
    },
    watch: {
    goods(newValue, oldValue) { // eslint-disable-line no-unused-vars
    this.show = true;
    }
    },
    methods:{
    closeClick(){
    this.show = false;
    }
    },
    components: {}
    };
    </script>
    讨论群:249728408
  • 相关阅读:
    Android 编程下 Eclipse 恢复被删除的文件
    Android 编程下背景图片适配工具类
    Android 编程下 Managing Your App's Memory
    Android 编程下代码之(QQ消息列表滑动删除)
    Android 编程下 Canvas and Drawables
    Android 编程下 AlarmManager
    Android 编程下去除 ListView 上下边界蓝色或黄色阴影
    Java 编程下字符串的 16 位、32位 MD5 加密
    C#枚举类型和int类型相互转换
    MVC和普通三层架构的区别
  • 原文地址:https://www.cnblogs.com/zhongyehai/p/12527878.html
Copyright © 2011-2022 走看看