码迷,mamicode.com
首页 > 其他好文 > 详细

使用x-template 定义模板

时间:2017-05-24 12:54:06      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:this   nts   code   com   pre   实例   his   app   使用   

demo

<script type="text/x-template" id="myFirstScriptComponent">
<p>this is my first scriptComponent</p>
</script>

使用x-template定义模板,设置id

在vue的实例中使用

new Vue({

  el:"#app",

  components:{    

    ‘script-component-demo‘:{
      template:‘#myFirstScriptComponent‘
    }

  }

}

});

html

<div id="app">
    <script-component-demo></script-component-demo>
</div>

 

使用x-template 定义模板

标签:this   nts   code   com   pre   实例   his   app   使用   

原文地址:http://www.cnblogs.com/xiaofenguo/p/6897828.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!