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>
  • 相关阅读:
    通知
    KVO详解
    KVC详解
    KVC/KVO总结
    结构体Struct
    检测文件(夹)大小
    NSFileHandle&&NSFileManage
    ***NSFileManager
    获取文件扩展名
    MySql数据库_03
  • 原文地址:https://www.cnblogs.com/rojas/p/6595463.html
Copyright © 2011-2022 走看看