在Vue3中组件通信中(子传父)报出如下警告:

[Vue warn]: Extraneous non-emits event listeners (changeParentProps) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the “emits” option.

解决方法:声明下自定义事件名称即可

emits: [‘changeParentProps’]

<template><div>子组件</div><button @click="changeParentProps">更改父组件传过来的props</button>
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api'
export default defineComponent({emits: ['changeParentProps'],props: {data: {type: String,default: ''}},setup (props, { emit }) {// console.log(props)const changeParentProps = () => {emit('changeParentProps', '123')}return {changeParentProps}}
})
</script>

Vue3警告:[Vue warn] Extraneous non-emits event listeners (changeParentProps) were passed to component相关推荐

  1. [vue]Extraneous non-emits event listeners (x) were passed to component but could not be automatica

    vue报错说: [Vue warn]: Extraneous non-emits event listeners (addToCart) were passed to component but co ...

  2. [Vue warn]: Do not use built-in or reserved HTML elements as component id: header

    一.Vue在引入组件后无法显示组件内容且报错如下: [Vue warn]: Do not use built-in or reserved HTML elements as component id: ...

  3. 工作214:结构 vue操作一个很有意思的报错 [Vue warn]: You may have an infinite update loop in a component

    结构 vue操作一个很有意思的报错 [Vue warn]: You may have an infinite update loop in a component render function. 代 ...

  4. 解决 VUE: [Vue warn]: Do not use built-in or reserved HTML elements as component id: xx

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1. 新增一个组件,运行无问题,但F12报错: vue.esm.js?efeb:591 [Vue w ...

  5. 解决:vue.esm.js?efeb:591 [Vue warn]: Do not use built-in or reserved HTML elements as component id: me

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1. 报错如题: vue.esm.js?efeb:591 [Vue warn]: Do not us ...

  6. Vue开发警告[Vue warn]: Avoid replacing instance root $data. Use nested data properties instead.

    Avoid replacing instance root $data. Use nested data properties instead. 翻译 避免替换实例根$data.请改用嵌套数据属性 错 ...

  7. vue3出现此警告信息:[Vue warn]: Failed to resolve component: dpan

    警告内容: runtime-core.esm-bundler.js:6870 [Vue warn]: Failed to resolve component: dpan 原因: 问题出现的原因是因为, ...

  8. Vue3.0使用Element Plus组件报错[Vue warn]: Failed to resolve component: `el-XXXX` If this is a native custo

    文章目录 报错截图 一.问题描述 二.报错信息格式 三.报错原因 报错截图 一.问题描述 我的技术栈:Vue3+TypeScript+Vite+Element Plus 我的报错:Vue3 项目使用 ...

  9. [Vue warn]: Error in callback for watcher “lists“: “TypeError: Cannot read property ‘length‘ of unde

    [Vue warn]: Error in callback for watcher "lists": "TypeError: Cannot read property ' ...

  10. Vue3报错:Extraneous non-props attributes (ref_key) were passed to component but could not be automatic

    Vue3报错:Extraneous non-props attributes (ref_key) were passed to component but could not be automatic ...

最新文章

  1. CentOs6.5中安装和配置vsftp简明教程
  2. (翻译) MongoDB(7) 安装MongoDB
  3. Java 并发:Executor ExecutorService ThreadPoolExecutor
  4. 95-260-050-源码-检查点-SavePoint
  5. MySQL中CASE的使用
  6. 黑马博客——详细步骤(三)项目功能的实现之新增用户
  7. CentOS:bash: g++: 未找到命令...
  8. 【专项测试】京东“安全测试”
  9. w10计算机恢复出厂设置,win10强制恢复出厂设置教程
  10. 汽车OBD诊断系统介绍
  11. Day41——Dp专题
  12. 从千播大战到不足百家,倒闭潮之下直播创业何去何从?
  13. RMB小写转换成大写
  14. Kafka or RabbitMQ:消息中间件选型深入分析
  15. AR Foundation
  16. 基于STM32单片机的智能家居毕设
  17. jsjquery获取url域名及参数的方法
  18. Gram矩阵和核函数
  19. 手写:下划线转为驼峰命名法
  20. 美可汗学院因用户基数过小决定移除其在Windows上的软件

热门文章

  1. Apache Pulsar 生态项目 KoP 新增 Maintainer:吴展鹏
  2. 启动docker 服务时 虚拟机端口转发 外部无法访问
  3. HDU-4826(DP动态)
  4. 函数对称性常见公式_高中函数对称性总结
  5. 中国移动mda移动桌面助手
  6. Js Switch语句
  7. python 计算斜率
  8. Android 仿微信全局字体大小调整
  9. Linux7下Mysql5.7搭建MHA(0.58版本)
  10. Unity使用脚本动态修改材质球的颜色