index.vue
1.45 KB
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
<template>
<div class="my-drop-menu">
<div class="left_widget label flex_cc">
<el-dropdown trigger="click" @command="onChangeValue">
<div class="h13_title">
{{ leftName }}
<i class="el-icon-caret-bottom el-icon-caret-top"></i>
</div>
<el-dropdown-menu slot="dropdown" class="drop_item">
<el-dropdown-item v-for="item in options" :key="item.value" :command="item">{{item.label}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="right_widget">
<slot name="right_con"></slot>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {}
},
props: {
leftName: {
type: String,
default: '请选择'
},
options:Array
},
mounted() {},
methods: {
onChangeValue(e){
this.leftName = e.label
this.$emit('getValue',e.value)
},
}
}
</script>
<style lang="scss" scoped>
.my-drop-menu {
display: flex;
align-items: center;
padding-left: 15px;
.left_widget {
box-sizing: border-box;
height: 28px;
border-radius: 4px 0px 0px 4px;
border: 1px solid #e8e8ea;
border-right: none;
cursor: pointer;
}
.el-icon-caret-bottom {
color: #999;
}
.label {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-right: none;
width: 80px;
}
}
</style>