<script lang="ts" setup>
interface Props {
bigArray: string[];
}
***const props = withDefaults(defineProps<Props>(), {
bigArray:[],
}*** <---- Here is the error, setting props
const bigArray = ref(props.BigArray);
</script>
Run Code Online (Sandbox Code Playgroud)
BigArray?: string[] | null;
Run Code Online (Sandbox Code Playgroud)
在这种情况下寻找将空数组设置为 prop 的正确方法: