I have defined a props object with certain attributes:
interface Props {
formList: BaseSearchFormListItemType[],
inline?: boolean
searchBtn?: {
show?: boolean
text?: string
type?: string
size?: string
}
}
const props = withDefaults(defineProps<Props>(), {
inline: true,
searchBtn: () => ({
show: true,
type: 'default',
text: '查询',
size: 'default'
})
})
searchBtn
has four optional attributes, but when this child-component is being used,
<BaseSearch
:formList="searchFormList"
:search-btn="{
show: true
// type: 'default',
// text: '查询',1
// size: 'default'
}"
:inline="false"/>
these four attributes become mandatory. How can I resolve this issue? enter image description here
Deleting the default values allows it to work, but I require the default values.