在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue這個是父子組件嗎?

vue這個是父子組件嗎?

網(wǎng)上看的這么一個父子組件通信的例子 這里就一個id為name的局部組件啊 沒有父組件啊 難道這個<users :age="content"></users>就是父組件嗎? 'users':user這句話本質不是就是這個局部組件嗎 為什么說是父子組件?父子組件定義是什么? 新手求大神給解析一下 謝謝

<!DOCTYPE html>
<html>
<head>
   <title></title>
   <style type="text/css">
   .icon {
      width: 1em; height: 1em;
      vertical-align: -0.15em;
      fill: currentColor;
      overflow: hidden;
   }
   .content{width: 200px;height: 200px;border: 1px solid black;}
   </style>
   <script src="vue.js"></script>
   <script src="svg/iconfont.js"></script>
   <style type="text/css">
   .name{color: red}
   </style>
   <script type="text/javascript">
      window.onload=function(){
         var user={
           template:"#name",
           props:['age'],
         }
         new Vue({
          el:"#app",
          data:{
             content:222
          },
          components:{
             'users':user
          },
          
         })
      }
   </script>
</head>
<body>
<template id="name">
       <div>
         <span class="name">{{age}}</span>
       </div>
</template>
<div id="app">
    <users :age="content"></users>
</div>
</body>
</html>
回答
編輯回答
青裙

app也是一個組件,也就是父組件

2017年2月4日 02:34
編輯回答
孤巷

如下例子:

<Component1>
    <Component2></Component2>
</Component1>
  • Component2是Component1的子組件。
  • Component1是Component2的父組件
2017年8月26日 00:25