-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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,子组件无法正常获取 #4897
Comments
刚刚测试,如果使用以下写法,打包后也是正常的: <script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
props: {
msg: {
type: Boolean,
required: true
}
}
})
</script>
<template>
<h4>msg: {{ msg ? 'msg true' : 'msg false' }}</h4>
</template> 综合各种情况,目前发现只有用 |
I'm seeing the same issue. |
I can reproduce this issue with Vite too. So I'm transferring it to the vue-next repository. |
It seems to work fine in the SFC playground |
The issue here is that in production mode, |
Oh the fix has just been merged: |
Will there be a new release soon, or do I have to downgrade? (and to which version?) |
Currently it is possible to explicitly pass a boolean value to prop. e.g: <Children
:selectable="true"
/> |
Not sure I want to incurr this debt. For posterity, this is how one could find the problematic props: rg --multiline --glob "*.vue" "<[A-Z][^ \n>]*(\s+[a-z-:@]+=\"[^\"]*\")*\s+[a-z-]+\s*[ \n>]" |
3.2.19可以 |
Version
5.0.0-beta.6
Reproduction link
github.com
Environment info
Steps to reproduce
What is expected?
页面渲染的文本应该是msg: msg true
What is actually happening?
msg: msg false
当我的子组件接收一个类型为Boolean的msg props的时候,我在父组件传入msg,正常情况下,子组件获取到msg的值应该是true。这在开发环境下是正确的。当我打包后msg的值是一个空字符串。
在提出这个问题之前,我尝试使用vue-cli创建了一个没有集成typescript的项目,它的表现是正常的。
The text was updated successfully, but these errors were encountered: