自学内容网 自学内容网

vue | 组件通信

props:父到子

基本结构

  • 子组件中,在props属性中声明变量名,例如props:[“nameFromParent”];
  • 父组件中通过 :变量名 传递。例如,<child-component :name-from-parent=varible>
    Parent.vue
<template>
  <div>this is Parent
    <Child 

原文地址:https://blog.csdn.net/YuuuPeeiiiii/article/details/142854106

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!