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
| <style scoped>
| .is-reverse {
| transform: rotate(-180deg);
| }
| </style>
| <template>
| <div>
| <el-popover
| placement="bottom"
| :width="width"
| :disabled="popoverDisabled"
| trigger="click"
| v-model="showing">
| <el-input ref="input" :readonly="readonly" :disabled="disabled" v-model="text" slot="reference" :placeholder="placeholder" @input="changeText" >
| <i slot="suffix" class="el-input__icon el-icon-arrow-down" :class="{'is-reverse': showing}"></i>
| </el-input>
| <slot :combo="this" v-show="!disabled">
| </slot>
| </el-popover>
| </div>
|
| </template>
| <script>
|
| export default {
| name: 'ZtCombo',
| props: {
| panelWidth: {
| type: Number,
| default: 200
| },
| value: [String, Array],
| disabled: {
| type: Boolean,
| default: false
| },
| readonly:{
| type: Boolean,
| default: false
| },
| placeholder: String
|
| },
| inject: {
| elForm: {
| default: ''
| }
| },
| data() {
| return {
| width: 'auto',
| showing: false,
| text: null
| }
| },
| computed: {
| popoverDisabled() {
| return this.disabled || (this.elForm || {}).disabled
| }
| },
| mounted() {
| // this.disabled = this.$refs.input ? this.$refs.input.disabled : false
| },
| methods: {
| // onShow() {
| // this.width = Math.max(this.$el.clientWidth - 24, this.panelWidth)
| // },
| close() {
| this.showing = false
| },
| setText(text) {
| this.text = text
| },
| changeText() {
| this.$emit('input-change', this.text)
| }
| }
| }
| </script>
|
|