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工作流
一张科幻照片,火星车在沙漠里ComfyUI工作流
一个神秘的隐藏面孔下一本书的剪影ComfyUI工作流
一名男子跪在月球岩石表面看见小行星碰撞
一匹热血沸腾的汗血宝马庄严地站立着ComfyUI工作流
一架受损严重的宇宙飞船内有一只猫
一只千纸鹤坐在路上哭泣ComfyUI工作流
一张精心制作的熊岛复古地图ComfyUI工作流
城市里出现一只可爱的小生物ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!