-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Vue warn]: Invalid prop: type check failed for prop "onChange". Expected Function, got Array #3933
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
Comments
Hello @w18701660942. Please provide a online reproduction by forking this link for vue2、 link for vue3 or a minimal GitHub repository. Make sure to choose the correct version. 你好 @w18701660942, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 for vue2、 此处 for vue3 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。请确保选择准确的版本。 |
我自己找到解决方法了,用emits重写一下,覆盖原来的方法就行,建议不要合并成数组 |
Since the issue was labeled with 由于该 issue 被标记为需要复现信息,却 7 天未收到回应。现关闭 issue,若有任何问题,可评论回复。 |
遇到同样的问题了 能详细说一下怎么解决的吗?谢谢!:D |
哦 我懂了 |
为什么会这样呢,我在setup中的emits添加 change 也不报警告了 |
请先允许我哭会, 刚开始用的"ant-design-vue": "3.1.0-rc.1"报这个告警, 然后更新为当前最新 "ant-design-vue": "3.1.0-rc.5" 还是报这个告警,虽然不影响使用,但是对于强迫症来说必须消除告警. 这个描述真的太隐晦了. 对于小白的我没看懂. 总之就是 在组件里面声明一下change的这个emit就好了, 底层原因没深究真的有点迷. 如下这么写一下就不告警了, 希望帮到别人. <script lang="ts" setup> const emit = defineEmits(['update:modelValue', 'change']); <script> |
thanks,我也遇到了这个问题,通过你的方法解决了。我是将upload挂在到vue实例上之后产生的这个错误。而且事件被判定为 |
那个问题好像是有一个拦截他的change事件然后分配给传过来的 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
2.1.1
Environment
开发
Reproduction link
http://localhost:8090/country/country_list
Steps to reproduce
开发2次组件时,只要加chang事件就报[Vue warn]: Invalid prop: type check failed for prop "onChange". Expected Function, got Array
What is expected?
能正常使用
What is actually happening?
能正常使用
<script lang="ts"> import { useEmits, useProps } from '@/hooks' import { defineComponent, ref } from 'vue' const plainOptions = ['Apple', 'Pear', 'Orange'] export default defineComponent({ props: { ...useProps(), value: Array, }, emits: ['update:value'], setup(props, ctx) { const { emit } = ctx const change = (checkedValue: any) => { emit('update:value',checkedValue) } return { change, plainOptions, value1: ref([]) } } }) </script>
The text was updated successfully, but these errors were encountered: