-
Notifications
You must be signed in to change notification settings - Fork 10
/
Cell.vue
86 lines (85 loc) · 1.96 KB
/
Cell.vue
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
<div class="wt-cell">
<div class="cell">
<slot name="left" v-if="privateSlot.left"></slot>
<div class="left">
<div class="title">
<span v-if="title != ''">{{title}}</span>
</div>
<slot name="label" v-if="privateSlot.label"></slot>
<span class="label" v-if="!privateSlot.label && label != ''">{{label}}</span>
</div>
<div class="right">
<slot name="right" v-if="privateSlot.right"></slot>
<div v-if="link != undefined" class="icon-right link"></div>
</div>
</div>
<slot name="bottom"></slot>
</div>
</template>
<script>
import {getCurrentInstance, reactive} from 'vue'
export default {
props:['title', 'label', 'link'],
setup(){
const {ctx} = getCurrentInstance()
const privateSlot = reactive({});
if (ctx.$slots.right) {
privateSlot.right = ctx.$slots.right();
}
if (ctx.$slots.left) {
privateSlot.left = ctx.$slots.left();
}
if (ctx.$slots.label) {
privateSlot.label = ctx.$slots.label();
}
return {
privateSlot
}
}
}
</script>
<style lang='less' rel='stylesheet/less' scoped>
.wt-cell {
background: #fff;
.cell {
display: flex;
justify-content: space-between;
align-items: center;
height: auto;
.left {
flex: 1;
.title {
display: flex;
justify-content: space-between;
i {
font-size: 1.2rem;
margin-right: 0.2rem;
}
span {
font-size: 0.9rem;
word-break: break-word;
}
}
}
.right {
display: flex;
height: 100%;
align-items: center;
.value {
color: #666;
}
.link {
color: #999;
margin: 0 0.4rem;
margin-right: 0;
}
}
}
.label {
font-size: 0.75rem;
color: #666;
margin: 0.2rem 0;
}
}
</style>