fix(components): [el-date-picker] ignore special flag (#5200)

fix #5067
This commit is contained in:
msidolphin
2022-01-08 19:41:56 +08:00
committed by GitHub
parent b8b60248a6
commit 53c3724b85
2 changed files with 23 additions and 1 deletions

View File

@@ -325,6 +325,26 @@ describe('DatePicker', () => {
expect(text.includes('csw')).toBeTruthy()
})
it('custom content bail out slot compoent', async () => {
_mount(
`<el-date-picker
v-model="value"
ref="input">
<slot name="testest"></slot>
</el-date-picker>`,
() => ({ value: '' }),
{
mounted() {
this.$refs.input.focus()
},
}
)
await nextTick()
const el = document.querySelector<HTMLElement>('td.available')
const text = el.textContent
expect(!!text).toBeTruthy()
})
describe('value-format', () => {
it('with literal string', async () => {
const day = dayjs()

View File

@@ -16,7 +16,9 @@ export default defineComponent({
const cell = props.cell
if (picker?.ctx.slots.default) {
const list = picker.ctx.slots.default(cell).filter((item) => {
return item.type.toString() !== 'Symbol(Comment)'
return (
item.patchFlag !== -2 && item.type.toString() !== 'Symbol(Comment)'
)
})
if (list.length) {
return list