1. 程式人生 > >vue實現箭頭向下的對話方塊

vue實現箭頭向下的對話方塊

<template>
    <div class="arrowDialogBox-container">
        <div class="arrowDialogBox">
            <slot></slot>
        </div>
    </div>
</template>

<script>
export default {

}
</script>

<style lang="scss" type="text/scss" rel="stylesheet/scss" scoped>
.arrowDialogBox-container{
    .arrowDialogBox {
        width: 260px;
        height: 307px;
        background-color: #fff;
        position: relative;
        border: 2px solid #f39700;
    }
        
    .arrowDialogBox:after,.arrowDialogBox:before {
        border:solid transparent;
        content:' ';
        height: 0;
        top: 100%;
        position: absolute;
        width: 0;
    }
        
    .arrowDialogBox:after {
        border-width: 8px;
        border-top-color: #fff;
        left: 17px;
    }
    
    /* 箭頭顏色*/
    .arrowDialogBox:before {
        border-width: 10px;
        border-top-color: #f39700;
        left: 15px;
    }
}

</style>

使用:

<arrowDialogBox>
    你自己定義的內容
</arrowDialogBox>