mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
chore(dynamic-tags, image): clean codes
This commit is contained in:
parent
51633e5fe6
commit
ede52ec472
@ -11,7 +11,9 @@ form
|
||||
slot
|
||||
```
|
||||
|
||||
## Props
|
||||
## API
|
||||
|
||||
### DynamicTags Props
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
@ -28,7 +30,7 @@ slot
|
||||
| value | `string[]` | `undefined` | Value in controlled mode. |
|
||||
| on-update:value | `(value: boolean) => void` | `undefined` | Callback when the component's value changes. |
|
||||
|
||||
## Slots
|
||||
### DynamicTags Slots
|
||||
|
||||
| Name | Parameters | Description |
|
||||
| --- | --- | --- |
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Slot
|
||||
# Customizing Input or Trigger Element
|
||||
|
||||
You can replace dynamic-tags's input or trigger element.
|
||||
|
||||
|
@ -11,7 +11,9 @@ form
|
||||
slot
|
||||
```
|
||||
|
||||
## Props
|
||||
## API
|
||||
|
||||
### DynamicTags Props
|
||||
|
||||
| 名称 | 类型 | 默认值 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
@ -28,9 +30,9 @@ slot
|
||||
| value | `string[]` | `undefined` | 受控模式下的值 |
|
||||
| on-update:value | `(value: boolean) => void` | `undefined` | 组件值发生变化时的回调 |
|
||||
|
||||
## Slots
|
||||
### DynamicTags Slots
|
||||
|
||||
| Name | Parameters | Description |
|
||||
| 名称 | 参数 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| input | `(info: { submit: (value: any) => void, })` | 自定义输入元素,由用户填充 |
|
||||
| trigger | `(info: { activate: () => void, disabled: boolean })` | 触发输入标签的组件或元素 |
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 插槽
|
||||
# 自定义输入或触发元素
|
||||
|
||||
你可以替换 `dynamic-tags` 的输入或触发元素。
|
||||
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
nextTick,
|
||||
toRef
|
||||
} from 'vue'
|
||||
import { useMergedState } from 'vooks'
|
||||
import commonProps from '../../tag/src/common-props'
|
||||
import { AddIcon } from '../../_internal/icons'
|
||||
import { NButton } from '../../button'
|
||||
@ -22,9 +23,7 @@ import type { MaybeArray, ExtractPublicPropTypes } from '../../_utils'
|
||||
import { dynamicTagsLight } from '../styles'
|
||||
import type { DynamicTagsTheme } from '../styles'
|
||||
import style from './styles/index.cssr'
|
||||
|
||||
import type { OnUpdateValue } from './interface'
|
||||
import { useMergedState } from 'vooks'
|
||||
|
||||
const dynamicTagsProps = {
|
||||
...(useTheme.props as ThemeProps<DynamicTagsTheme>),
|
||||
|
@ -61,15 +61,16 @@ export default defineComponent({
|
||||
imageRef,
|
||||
imgProps: imgPropsRef,
|
||||
handleClick: () => {
|
||||
const mergedPreviewSrc = props.previewSrc || props.src
|
||||
if (imageGroupHandle) {
|
||||
imageGroupHandle.setPreviewSrc(props.previewSrc || props.src)
|
||||
imageGroupHandle.setPreviewSrc(mergedPreviewSrc)
|
||||
imageGroupHandle.setThumbnailEl(imageRef.value)
|
||||
imageGroupHandle.toggleShow()
|
||||
return
|
||||
}
|
||||
const { value: previewInst } = previewInstRef
|
||||
if (!previewInst) return
|
||||
previewInst.setPreviewSrc(props.previewSrc || props.src)
|
||||
previewInst.setPreviewSrc(mergedPreviewSrc)
|
||||
previewInst.setThumbnailEl(imageRef.value)
|
||||
previewInst.toggleShow()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user