Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

If Props'property is not "basic type" ,<withDefaults> will give undefined to them. #62

Closed
@Darma1106

Description

@Darma1106

example :

<script setup lang="ts">
import { onMounted } from '@vue/composition-api';
type Test = number[];

interface Props{
    test: number[];
    test2: Test;
}
const props = withDefaults(defineProps<Props>(), {
    test:()=>[1, 2, 3],
    test2:()=>[1, 2, 3]
});

onMounted(()=>{
    console.log(props, 'props'); // => { test: [1,2,3] , test2:undefined }
});
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions