-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prop boolean
required type error
#8852
Labels
Comments
Required: <script lang="ts" setup>
const props = defineProps<{
b1: boolean;
b2: boolean;
b3: boolean;
s1: string;
s2: string;
}>();
</script> Optional: <script lang="ts" setup>
const props = defineProps<{
b1?: boolean;
b2?: boolean;
b3?: boolean;
s1?: string;
s2?: string;
}>();
</script> |
PropType一般用于定义复杂变量(例如:数组、对象、函数)的类型定义,布尔类型或字符串类型直接定义即可,PropType会造成prop变量接口定义为可选变量。 |
In my opinion, props in vue3 are defined as optional. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vue version
3.3.4
Link to minimal reproduction
https://play.vuejs.org/#eNp9UsFOwzAM/RWTy0Aam2C3qUwChAQcAAESl1zK6pZAmoQ4GUNV/x03ZR2T0JRL/OznPD+nEefOTVYRxVxIszkZLb1yAQhDdKBzU51JEUiKhTSqdtYHaCB8O4QHb90zX8bgsYQWSm9rGHG/UddnaQ0FcFxDcAYFlspgx6DDRhqA15M5XFirMTfjFJ8OMeQ09M5ee2zRF83mkNiQFOx2AJbxGZXHYg5lrgl/UX46jzr8gh3Wpgyxgqfglan6kAX04c77lCCevT3aTlVTxTPx1Ieja9Tawov1ujgYcUk27f1jBgcBa6fzgBwBZG8ni6ZJ5LbNphwlVBkXA6yOa1ugZq85n8zOpgNbjHkD/HSpqsk7WcMLSzZIsbS1Uxr9vQuKpUkxGCRFzsq+bhMWfNzYwZw3XH78g7/TusOkePBI6FcoxZALua8w9Omrpztc831IsvKouXpP8hHJ6thp7MsuoilY9p+6pPYmfTA2/Jmu1gENbYbqhG5XJwX/sss9o2/lziazxOMFivYHQQ360g==
Steps to reproduce
What is expected?
属性
b1、b2、b3
的required
不一致。What is actually happening?
属性
b1、b2、b3
的required
一致。System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: