vue开发中,如何获取父组件传递的值?下面web建站小编给大家简单介绍一下具体实现代码!
具体代码如下:
<template> <h2>子组件</h2> <div @click="sonHander"> 我是子组件中的数据 </div> <h2>使用了props声明接收==>{{ mytitle }}</h2> <h2>使用参数attrs获取==>{{ attrs.othertitle }}</h2> </template> <script> import { defineComponent,setup } from "vue"; export default defineComponent({ name: "NoCont", props:{ mytitle:{ type:Object } }, setup(props,{attrs,slots,emit}){ function sonHander(){ emit("sonclick","子组件传递给父组件") } return {sonHander,attrs} } }); </script>
vue全局动态添加meta属性(title,keywords,description)
vue语法中$router和$route有什么不同?附示例代码
上面是“vue语法如何获取父组件传递的值”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4583.html
workflows工作流
一个白色的咖啡杯,蒸汽从杯子里冒出来
1个可爱的白色短发女孩
去掉背景(抠图)comfyui工作流
一个超现实和超现实的场景,在森林中心有一座蛇形的房子
强大的长袍法师ComfyUI工作流
一座生动的点彩主义灯塔ComfyUI工作流
一颗闪闪发光的水晶漂浮在森林里
完整海报生成comfyui工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!