color-picker.vue
3.89 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<template>
<div style="margin: 100px;">
{{color}}
<!--<Input placeholder="请输入..." size="large" style="width: 50px;"></Input>-->
<color-picker
v-model="color"
placement="bottom-start"
@on-change="c1"
@on-active-change="c2"></color-picker>
<Input value="hello" style="display: inline-block" />
<Date-picker
type="date"
placeholder="选择日期"
style="width: 200px"></Date-picker>
<color-picker
ref="xxx"
v-model="color"
:recommend="true"
format="rgb"
alpha
@on-change="onChange"
@on-active-change="onActiveChange"></color-picker>
<color-picker
v-model="color2"
:alpha="true"
:recommend="false"
format="hsv"></color-picker>
<!--<Date-picker type="date" placeholder="选择日期" style="width: 200px"></Date-picker>-->
<color-picker
v-model="color"
placement="bottom-start"
></color-picker>
<Date-picker
type="date"
placeholder="选择日期"
style="width: 200px"></Date-picker>
<color-picker
ref="yyy"
:colors="colors"
v-model="color"
format="rgb"
alpha></color-picker>
<Button @click="setColor">set color</Button>
<br><br><br><br>
{{openState}}
<ColorPicker
v-model="color7"
:hue="false"
@on-open-change="onOpenChange"></ColorPicker>
<ColorPicker
v-model="color7"
:hue="false"
:hide-drop-down="hideDropDown"
@on-open-change="onOpenChange"></ColorPicker>
<br><br><br><br>
<ColorPicker
v-model="color7"
disabled></ColorPicker>
</div>
</template>
<script>
export default {
props: {},
data() {
return {
color: 'rgba(12,34,255,.85)',
color2: '',
color7: '#19be6b',
openState: false,
colors: [
'#2d8cf0',
'#19be6b',
'#ff9900',
'#ed3f14',
'#00b5ff',
'#19c919',
'#f9e31c',
'#ea1a1a',
'#9b1dea',
'#00c2b1',
'#ac7a33',
'#1d35ea',
'#8bc34a',
'#f16b62',
'#ea4ca3',
'#0d94aa',
'#febd79',
'#5d4037',
'#00bcd4',
'#f06292',
'#cddc39',
'#607d8b',
'#000000',
'#ffffff',
'#2d8cf0',
'#19be6b',
'#ff9900',
'#ed3f14',
'#00b5ff',
'#19c919',
'#f9e31c',
'#ea1a1a',
'#9b1dea',
'#00c2b1',
'#ac7a33',
'#1d35ea',
'#8bc34a',
'#f16b62',
'#ea4ca3',
'#0d94aa',
'#febd79',
'#5d4037',
],
hideDropDown: false,
};
},
computed: {},
mounted() {
setInterval(this.toggleShowHide, 2000);
},
methods: {
setColor() {
this.color = '#26bc77';
},
c1(d) {
console.log(d);
},
c2(d) {
console.log(d);
},
onOpenChange(state) {
this.openState = state;
},
onChange(d) {
console.log(d);
},
onActiveChange(d) {
console.log(d);
},
toggleShowHide() {
this.hideDropDown = !this.hideDropDown;
},
},
};
</script>