mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-18 10:59:10 +08:00
feat(components): [cascader] add prefix
slot (#19631)
* feat(components): [cascader] add prefix slot
* docs(components): [cascader] add preview slot
* Revert "docs(components): [cascader] add preview slot"
This reverts commit 1a40ca13ea
.
* docs(components): [cascader] revert for typo
* fix(components): do not render prefix if prefix slot is not used
* docs(components): [cascader] prefix version number added
Co-authored-by: btea <2356281422@qq.com>
* docs(components): [cascader] format docs
---------
Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
parent
add84b5694
commit
40a616ea1a
@ -175,10 +175,11 @@ cascader/panel
|
||||
|
||||
### Cascader Slots
|
||||
|
||||
| Name | Description | Scope |
|
||||
| ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------- |
|
||||
| default | the custom content of cascader node, which are current Node object and node data respectively. | ^[object]`{ node: any, data: any }` |
|
||||
| empty | content when there is no matched options. | — |
|
||||
| Name | Description | Scope |
|
||||
| --------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------- |
|
||||
| default | the custom content of cascader node, which are current Node object and node data respectively. | ^[object]`{ node: any, data: any }` |
|
||||
| empty | content when there is no matched options. | — |
|
||||
| prefix ^(2.9.4) | content as Input prefix | — |
|
||||
|
||||
### Cascader Exposes
|
||||
|
||||
|
@ -559,4 +559,19 @@ describe('Cascader.vue', () => {
|
||||
expect(emptySlotEl?.textContent).toBe('-=-empty-=-no-data')
|
||||
})
|
||||
})
|
||||
|
||||
describe('render prefix slot', () => {
|
||||
it('correct render prefix slot', async () => {
|
||||
_mount(() => (
|
||||
<Cascader>
|
||||
{{
|
||||
prefix: () => <div>-=-prefix-=-</div>,
|
||||
}}
|
||||
</Cascader>
|
||||
))
|
||||
|
||||
const prefixSlotEl = document.querySelector('.el-input__prefix-inner')
|
||||
expect(prefixSlotEl?.textContent).toBe('-=-prefix-=-')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -42,6 +42,9 @@
|
||||
@blur="handleBlur"
|
||||
@input="handleInput"
|
||||
>
|
||||
<template v-if="$slots.prefix" #prefix>
|
||||
<slot name="prefix" />
|
||||
</template>
|
||||
<template #suffix>
|
||||
<el-icon
|
||||
v-if="clearBtnVisible"
|
||||
|
Loading…
Reference in New Issue
Block a user