vue开发中,如何实现子组件向父组件派发事件?下面web建站小编给大家简单介绍一下具体实现代码!
具体代码如下:
<template> <div @click="sonHander"> 我是子组件中的数据 </div> </template> <script> import { defineComponent,setup } from "vue"; export default defineComponent({ name: "NoCont", props:{ mytitle:{ type:Object } }, setup(props,context){ function sonHander(){ context.emit("sonclick","子组件传递给父组件") } return {sonHander} } }); </script>
vue全局动态添加meta属性(title,keywords,description)
vue语法中$router和$route有什么不同?附示例代码
上面是“vue语法如何实现子组件向父组件派发事件”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4582.html
workflows工作流
一个骷髅海盗船长ComfyUI工作流
三阶放大comfyui工作流
池塘边的大熊猫ComfyUI工作流
一张精心制作的熊岛复古地图ComfyUI工作流
未来椅子3D产品ComfyUI工作流
一只放屁虫甲虫ComfyUI工作流
一尊白玉猴王ComfyUI工作流
森林里有一个皮肤像抛光黑曜石的生物
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!