<template>
    <div :class="$style.rect">
        <div
            :class="$style.func"
            :style="{paddingTop:`${AspectRatio}%`}"
        >
            <div :style="{marginTop:`-${AspectRatio}%`}"/>
        </div>
        <div :class="$style.content">
            <slot/>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'MyRect',
        data:function(){
            return {
                AspectRatio:this.respH/this.respW*100
            }
        },
        props:{
            respW:{
                type:Number,
                default:1
            },
            respH:{
                type:Number,
                default:1
            }
        }
    }
</script>

<style module lang="scss">
    .rect{
        width: 100%;
        position: relative;
        >.func{
            position: relative;
            visibility: hidden;
            opacity: 0;
            pointer-events: none;
            overflow: hidden;
        }
        >.content{
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
        }
    }
</style>
