feat(components): [color-picker] add show hide expose (#11942)

* feat(components): [color-picker]

add handleTrigger expose

closed #11926
This commit is contained in:
xiterjia 2023-04-01 21:24:03 +08:00 committed by GitHub
parent 80a005714d
commit e6be1bc3cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -72,6 +72,8 @@ color-picker/sizes
### Exposes
| Name | Description | Type |
| ----- | -------------------- | ---------------- |
| color | current color object | ^[object]`Color` |
| Name | Description | Type |
| ----- | ------------------------- | ----------------------- |
| color | current color object | ^[object]`Color` |
| show | manually show ColorPicker | ^[Function]`() => void` |
| hide | manually hide ColorPicker | ^[Function]`() => void` |

View File

@ -217,6 +217,11 @@ function setShowPicker(value: boolean) {
const debounceSetShowPicker = debounce(setShowPicker, 100)
function show() {
if (colorDisabled.value) return
setShowPicker(true)
}
function hide() {
debounceSetShowPicker(false)
resetColor()
@ -331,5 +336,13 @@ defineExpose({
* @description current color object
*/
color,
/**
* @description manually show ColorPicker
*/
show,
/**
* @description manually hide ColorPicker
*/
hide,
})
</script>