zoukankan      html  css  js  c++  java
  • vuejs scope

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>vue</title>
    
         <!-- 
        <script src="vue.js"></script>
        -->
        
     <script src="https://unpkg.com/vue/dist/vue.js"></script>
     
    </head>
    <body> 
     
     <div id="counter-event-example">
      <parent></parent>
    </div>
     
    <script>
    
    Vue.component('child', {
      // 有效,因为是在正确的作用域内
      template: '<div class="child">  <slot text="hello from child"></slot></div>',
      data: function () {
        return {
          someChildProperty: true
        }
      }
    })
    
    
    
    
    Vue.component('parent', {
      // 有效,因为是在正确的作用域内
      template:'<div class="parent">  <child>    <template scope="props">      <span>hello from parent</span>  <br>    <span>{{ props.text }}</span>    </template>  </child></div>',
      data: function () {
        return {
          someChildProperty: true
        }
      }
    })
    
    
    
    
     
    new Vue({
      el: '#counter-event-example'
    })
    
    
    </script>
    
    
    
    </body>
    </html>
  • 相关阅读:
    .NET Framework 1.13.5 版本安装包下载链接
    可遇不可求的Question之MYSQL获取自增ID的四种方法篇
    20110917 晴
    北海道 7天6夜 自助游
    想你了
    猫忘带电话了
    [转载经验] 探亲签证申请
    帮忙打印
    打印机
    20110910 晴
  • 原文地址:https://www.cnblogs.com/rojas/p/6595463.html
Copyright © 2011-2022 走看看