提交 | 用户 | 时间
|
314507
|
1 |
<template> |
H |
2 |
<el-input v-model="color"> |
|
3 |
<template #prepend> |
|
4 |
<el-color-picker v-model="color" :predefine="PREDEFINE_COLORS" /> |
|
5 |
</template> |
|
6 |
</el-input> |
|
7 |
</template> |
|
8 |
|
|
9 |
<script setup lang="ts"> |
|
10 |
import { propTypes } from '@/utils/propTypes' |
|
11 |
import { PREDEFINE_COLORS } from '@/utils/color' |
|
12 |
|
|
13 |
// 颜色输入框 |
|
14 |
defineOptions({ name: 'ColorInput' }) |
|
15 |
|
|
16 |
const props = defineProps({ |
|
17 |
modelValue: propTypes.string.def('') |
|
18 |
}) |
|
19 |
const emit = defineEmits(['update:modelValue']) |
|
20 |
const color = computed({ |
|
21 |
get: () => { |
|
22 |
return props.modelValue |
|
23 |
}, |
|
24 |
set: (val: string) => { |
|
25 |
emit('update:modelValue', val) |
|
26 |
} |
|
27 |
}) |
|
28 |
</script> |
|
29 |
|
|
30 |
<style scoped lang="scss"> |
|
31 |
:deep(.el-input-group__prepend) { |
|
32 |
padding: 0; |
|
33 |
} |
|
34 |
</style> |