Skip to content

Commit c22cafa

Browse files
authored
feat: 添加颜色选择器面板组件 (#1242)
1 parent f7bf20a commit c22cafa

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed

locales/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ menus:
108108
pureTypeit: Typeit
109109
pureJsonEditor: JSON Editor
110110
pureColorPicker: Color Picker
111+
pureColorPickerPanel: Color PickerPanel
111112
pureDatePicker: Date Picker
112113
pureDateTimePicker: DateTimePicker
113114
pureTimePicker: TimePicker

locales/zh-CN.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ menus:
108108
pureTypeit: 打字机
109109
pureJsonEditor: JSON编辑器
110110
pureColorPicker: 颜色选择器
111+
pureColorPickerPanel: 颜色选择器面板
111112
pureDatePicker: 日期选择器
112113
pureDateTimePicker: 日期时间选择器
113114
pureTimePicker: 时间选择器

src/router/modules/components.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ export default {
119119
name: "PureSlider",
120120
component: () => import("@/views/components/slider/index.vue"),
121121
meta: {
122-
title: $t("menus.pureSlider"),
123-
extraIcon: "IF-pure-iconfont-new svg"
122+
title: $t("menus.pureSlider")
124123
}
125124
},
126125
{
@@ -195,6 +194,15 @@ export default {
195194
title: $t("menus.pureColorPicker")
196195
}
197196
},
197+
{
198+
path: "/components/color-picker-panel",
199+
name: "ColorPickerPanel",
200+
component: () => import("@/views/components/color-picker-panel.vue"),
201+
meta: {
202+
title: $t("menus.pureColorPickerPanel"),
203+
extraIcon: "IF-pure-iconfont-new svg"
204+
}
205+
},
198206
{
199207
path: "/components/selector",
200208
name: "Selector",
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<script setup lang="ts">
2+
import { ref } from "vue";
3+
4+
defineOptions({
5+
name: "ColorPickerPanel"
6+
});
7+
8+
const disabled = ref(false);
9+
const color = ref("rgba(255, 69, 0, 0.68)");
10+
const predefineColors = [
11+
"#ff4500",
12+
"#ff8c00",
13+
"#ffd700",
14+
"#90ee90",
15+
"#00ced1",
16+
"#1e90ff",
17+
"#c71585",
18+
"rgba(255, 69, 0, 0.68)",
19+
"rgb(255, 120, 0)",
20+
"hsv(51, 100, 98)",
21+
"hsva(120, 40, 94, 0.5)",
22+
"hsl(181, 100%, 37%)",
23+
"hsla(209, 100%, 56%, 0.73)",
24+
"#c7158577"
25+
];
26+
</script>
27+
28+
<template>
29+
<el-card shadow="never">
30+
<template #header>
31+
<div class="card-header">
32+
<el-space wrap :size="40">
33+
<el-link
34+
v-tippy="{
35+
content: '点击查看详细文档'
36+
}"
37+
href="https://element-plus.org/zh-CN/component/color-picker-panel.html"
38+
target="_blank"
39+
style="font-size: 16px; font-weight: 800"
40+
>
41+
颜色选择器面板
42+
</el-link>
43+
<el-radio-group v-model="disabled">
44+
<el-radio :value="false">启用</el-radio>
45+
<el-radio :value="true">禁用</el-radio>
46+
</el-radio-group>
47+
</el-space>
48+
</div>
49+
<el-link
50+
class="mt-2"
51+
href="https://github.com/pure-admin/vue-pure-admin/blob/main/src/views/components/color-picker-panel.vue"
52+
target="_blank"
53+
>
54+
代码位置 src/views/components/color-picker-panel.vue
55+
</el-link>
56+
</template>
57+
58+
<div class="mb-2">选择透明度、预定义颜色、无边框</div>
59+
<el-color-picker-panel
60+
v-model="color"
61+
show-alpha
62+
:border="false"
63+
:disabled="disabled"
64+
:predefine="predefineColors"
65+
/>
66+
<el-divider />
67+
</el-card>
68+
</template>

0 commit comments

Comments
 (0)