When Vue3 parent-child components pass values, defineProps uses defined custom data types

I want to receive the content of the string array type passed by the parent component in the child component, but how to define it?

If you simply write in it like this:

An error will be reported: the type "unknown[]" cannot be assigned to the type "string[]"

How should that be defined?

The form of the type definition structure using defineProps: just fine

const props = defineProps<{
  imgUrl: string,
  srcList: string[]


Guess you like

Origin blog.csdn.net/weixin_44786530/article/details/131331833