whyczyk
2020-10-28 64b7d07f3c3901ed9bb377b5f4a2f554df5c16c9
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
69
<template>
    <el-tooltip :class="stateName" effect="dark" :content="content" placement="bottom">
        <div class="statusWarp">
            <i class="iconfont" :class="icon"></i>
        </div>
    </el-tooltip>
</template>
 
<script>
    export default {
        props: {
            state: {
                type: Number,
                default: 0
            },
            icon: {
                type: String,
                default: '',
            },
            content: {
                type: String,
                default: '未知'
            }
        },
        computed: {
            stateName() {
                let result = '';
                switch (this.state) {
                    case 0:
                        result = 'error-state';
                        break;
                    case 1:
                        result = "";
                        break;
                    case 2:
                        result = "stop-state";
                        break;
                }
                return result;
            }
        }
    }
</script>
 
<style scoped>
    
    .statusWarp{
        margin-right: 10px;
        vertical-align: top;
        cursor: pointer;
        width: 22px;
        height: 22px;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
        background-color: #4ba1fa;
    }
    .statusWarp.error-state{
        background-color: #ff5503;
    }
    .statusWarp.stop-state{
        background-color: #afafaf;
    }
    .iconfont {
        font-size: 12px;
        color: #041f6c;
    }
</style>