初始版本提交

This commit is contained in:
yaoyn
2024-02-05 09:15:37 +08:00
parent b52d4414be
commit 445292105f
1848 changed files with 236859 additions and 75 deletions

View File

@ -0,0 +1,4 @@
import { withInstall } from '/@/utils';
import colorPicker from './src/ColorPicker.vue';
export const ColorPicker = withInstall(colorPicker);

View File

@ -0,0 +1,49 @@
<template>
<div>
<input
type="color"
:value="colorValue"
@change="handleChange"
:style="{ 'pointer-events': disabled ? 'none' : 'auto' }"
/>
</div>
</template>
<script lang="ts" setup>
import { ref, watch } from 'vue';
const props = defineProps({
size: String,
value: String,
defaultValue: String,
disabled: {
type: Boolean,
default: false,
},
});
const colorValue = ref('#ffffff');
const emit = defineEmits(['update:value', 'change']);
watch(
() => props.value,
(val) => {
colorValue.value = val || '#ffffff';
},
{
immediate: true,
},
);
watch(
() => props.defaultValue,
(val) => {
if (val) {
emit('update:value', val);
}
},
{
immediate: true,
},
);
const handleChange = ({ target }) => {
emit('update:value', target.value);
emit('change', target.value);
};
</script>