ExpandPanel.san 1.2 KB
Newer Older
B
BingBlog 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<template>
    <div class="visaul-dl-expand-panel">
        <h3
            class="visaul-dl-expand-head"
            on-click="handleHeadClick()"
        >
            <span>{{title}}</span>
        </h3>
        <div
            style="display:{{displayStyle}}"
            class="visaul-dl-expand-panel-content"
        >
            <slot></slot>
        </div>
    </div>
</template>
<script>
export default {
    computed: {
        displayStyle() {
            let isShow = this.data.get('isShow');
            return isShow ? 'block' : 'none';
        }
    },
    initData() {
        return {
            isShow: false
        };
    },
    handleHeadClick() {
        this.toogleShow();
    },
    toogleShow() {
        let isShow = this.data.get('isShow');
        this.data.set('isShow', !isShow);
    }
};
</script>
<style lang="stylus">
    .visaul-dl-expand-panel
        .visaul-dl-expand-head
            border solid 1px #e4e4e4
            line-height 50px
            height 50px
            padding 0 20px
            cursor pointer
        .visaul-dl-expand-panel-content
            padding 0 20px
        .visaul-dl-expand-panel-content:after
            content: "";
            clear: both;
            display: block;
</style>