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
| <template>
| <view v-show="isShow">
| <view class="shade" @tap="hide">
| <view class="pop">
| <view class="list flex_col" v-for="(item,index) in colorArr" :key="index">
| <view v-for="(v,i) in item" :key="i" :style="{'backgroundColor':v}" :data-color="v"
| :data-index="index" :data-i="i" :class="{'active':(index==pickerArr[0] && i==pickerArr[1])}"
| @tap.stop="picker"></view>
| </view>
| </view>
| </view>
| </view>
| </template>
|
| <script>
| export default {
| name: 'picker-color',
| props: {
| isShow: {
| type: Boolean,
| default: false,
| },
| bottom: {
| type: Number,
| default: 0,
| }
| },
| data() {
| return {
| colorArr: [
| ['#000000', '#111111', '#222222', '#333333', '#444444', '#666666', '#999999', '#CCCCCC', '#EEEEEE',
| '#FFFFFF'
| ],
| ['#ff0000', '#ff0033', '#ff3399', '#ff33cc', '#cc00ff', '#9900ff', '#cc00cc', '#cc0099', '#cc3399',
| '#cc0066'
| ],
| ['#cc3300', '#cc6600', '#ff9933', '#ff9966', '#ff9999', '#ff99cc', '#ff99ff', '#cc66ff', '#9966ff',
| '#cc33ff'
| ],
| ['#663300', '#996600', '#996633', '#cc9900', '#a58800', '#cccc00', '#ffff66', '#ffff99', '#ffffcc',
| '#ffcccc'
| ],
| ['#336600', '#669900', '#009900', '#009933', '#00cc00', '#66ff66', '#339933', '#339966', '#009999',
| '#33cccc'
| ],
| ['#003366', '#336699', '#3366cc', '#0099ff', '#000099', '#0000cc', '#660066', '#993366', '#993333',
| '#800000'
| ]
| ],
| pickerColor: '',
| pickerArr: [-1, -1]
| };
| },
| methods: {
| picker(e) {
| let data = e.currentTarget.dataset;
| this.pickerColor = data.color;
| this.pickerArr = [data.index, data.i];
| this.$emit("callback", this.pickerColor);
| },
| hide() {
| this.$emit("callback", '');
| },
| },
| }
| </script>
|
| <style scoped>
| .shade {
| position: fixed;
| top: 0;
| right: 0;
| bottom: 0;
| left: 0;
| background-color: rgba(0, 0, 0, 0.5);
| z-index: 10080;
| display: flex;
| justify-content: center;
| align-items: center
| }
|
| .pop {
| border-radius: 8px;
| background-color: #fff;
| z-index: 100;
| padding: 12upx;
| font-size: 32upx;
| transform: rotate(90deg);
| }
|
| .flex_col {
| display: flex;
| flex-direction: row;
| flex-wrap: nowrap;
| justify-content: flex-start;
| align-items: center;
| align-content: center;
| }
|
| .list {
| justify-content: space-between;
| }
|
| .list>view {
| width: 60upx;
| height: 60upx;
| margin: 5upx;
| box-sizing: border-box;
| border-radius: 3px;
| box-shadow: 0 0 2px #ccc;
| }
|
| .list .active {
| box-shadow: 0 0 2px #09f;
| transform: scale(1.05, 1.05);
| }
|
| .preview {
| width: 180upx;
| height: 60upx;
| }
|
| .value {
| margin: 0 40upx;
| flex-grow: 1;
| }
|
| .ok {
| width: 160upx;
| height: 60upx;
| line-height: 60upx;
| text-align: center;
| background-color: #ff9933;
| color: #fff;
| border-radius: 4px;
| letter-spacing: 3px;
| font-size: 32upx;
| }
|
| .ok:active {
| background-color: rgb(255, 107, 34);
| }
| </style>
|
|