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>
  • 相关阅读:
    书_Delphi
    20160226
    SVG_style_script
    辅助
    电影_Z
    Windows下软件调试
    20160221
    Qt5.3.2_vs10_发布时所需DLL的路径
    android intent 传数据
    android 消息机制
  • 原文地址:https://www.cnblogs.com/rojas/p/6595463.html
Copyright © 2011-2022 走看看