<template>
    <div class="slide-btn" :style="style" @click="toggle">
        <i :class="i_class"></i>
    </div>
</template>

<script>
export default {
    name: "slide-btn",
    data() {
        return {
            fold: false
        }
    },
    props: {
        isCollapse: {
            type: Boolean,
            default: false,//是否折叠菜单 64px 200px
        }
    },
    computed: {
        style() {
            return {
                // left: this.fold ? "-4px" :
                // this.isCollapse ? "63px" : "192px",
                transition: `left 0.3s`,
				right: "-8px",
				position: "absolute",
            }
        },
        i_class() {
            return "el-icon-d-arrow-" + (this.fold ? "right" : "left")
        }
    },
    methods: {
        toggle() {
            this.fold = !this.fold;
            this.$emit("change", !this.fold);
        }
    }
}
</script>

<style scoped lang="less">
.slide-btn {
    z-index: 100;
    position: fixed;
    top: 100px;/*calc(50% - 92px);*/
    border-radius: 8px;
    box-shadow: 0 2px 8px 0 rgb(0 0 0 / 6%);
    border: 1px solid #E7E9E8;
    width: 14px;
    height: 44px;
    line-height: 44px;
    text-align: center;
    font-size: 12px;
    background: #ffffff;
    color: #b7b7b7;
    cursor: pointer;
}
</style>
