# BiuDrawer 抽屉

通常用来显示数据较多的详情页。

提示

关于 footer 的更多用法可以查看 Operation 组件

<template>
    <div>
        <el-button @click="show = true">查看详情</el-button>
        <el-button @click="add.show = true">添加</el-button>

        <biu-drawer title="订单详情" :visible.sync="show" footer>
            <pre>
                哈哈哈
                哈哈哈
                哈哈哈
                哈哈哈
                哈哈哈
                哈哈哈
            </pre>
        </biu-drawer>

        <biu-drawer title="添加" :visible.sync="add.show" :footer="footer">
            <pre>
                你可以

                展示

                你想展示的

                比如

                <li v-for="(item, index) in Array(50).fill('')" :key="index">{{index}}</li>
            </pre>
        </biu-drawer>
    </div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import { OperationOptionType } from 'calm-harbin/types/operation'

@Component
export default class BiuDiaBiuDrawerDemologDemo extends Vue {
    show = false

    add = {
        show: false
    }

    loading = false

    get footer(): OperationOptionType[] {
        return [
            {
                title: '确认',
                loading: this.loading,
                callback: () => {
                    this.loading = true
                    setTimeout(() => {
                        this.$notify({
                            title: '提交成功',
                            message: '成功添加一条运单',
                            type: 'success'
                        })
                        this.loading = false
                        this.add.show = false
                    }, 1000)
                }
            }
        ]
    }
}
</script>
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
56
57
58
59
60
61
62
63
64
65
66
67
68
显示代码

# 属性

参数 说明
必填
类型 默认值
title 标题 string
visible 是否显示 boolean
btnLoading 控制所有按钮的 loading 状态 boolean
footer 按钮配置