Skip to content

Commit

Permalink
feat(components): [color-picker] add show hide expose (element-pl…
Browse files Browse the repository at this point in the history
…us#11942)

* feat(components): [color-picker]

add handleTrigger expose

closed element-plus#11926
  • Loading branch information
xiterjia authored Apr 1, 2023
1 parent 80a0057 commit e6be1bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/en-US/component/color-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
13 changes: 13 additions & 0 deletions packages/components/color-picker/src/color-picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -331,5 +336,13 @@ defineExpose({
* @description current color object
*/
color,
/**
* @description manually show ColorPicker
*/
show,
/**
* @description manually hide ColorPicker
*/
hide,
})
</script>

0 comments on commit e6be1bc

Please sign in to comment.