feat(components): [cascader] add prefix slot

This commit is contained in:
Kitano
2025-01-13 17:47:29 +08:00
parent 66c03b823f
commit 9bea9a4ddd
2 changed files with 18 additions and 0 deletions

View File

@@ -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-=-')
})
})
})

View File

@@ -42,6 +42,9 @@
@blur="handleBlur"
@input="handleInput"
>
<template #prefix>
<slot name="prefix" />
</template>
<template #suffix>
<el-icon
v-if="clearBtnVisible"