zoukankan      html  css  js  c++  java
  • 38.VUE学习之-全局组件和局部组件

    <!DOCTYPE html>
    <html>
    <head>
    	<meta charset="utf-8">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<title>vue</title>
    	<link rel="stylesheet" href="">
    	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    	<!-- <script type="text/javascript" src="../js/vue.js"></script> -->
    
    </head>
    <body>
    <div id="hdcms">
    	<hd-slide></hd-slide>
    	<hd-news></hd-news>
    	<hdcomtent></hdcomtent>
    
    </div>
    <script>
    	//全局组件,必需要放在new Vue的上面
       Vue.component('hdSlide',{
           template:'<h1>hellow Vue,slide.</h1>',
       });
    
    
        var hdNews = {
            template: "<h2>你好后盾人</h2>",
        };
        var hdcomtent = {
            template: "<h2>测试内容</h2>",
        };
        new Vue({
            el: '#hdcms',
    		//局部组件 注册组件的名字
            components: {hdNews,hdcomtent}
    
        });
    </script>
    </body>
    </html>
    
  • 相关阅读:
    config https in nginx(free)
    js hex string to unicode string
    alter character set
    es6
    音乐播放器
    JS模块化-requireJS
    PHP中的封装和继承
    JavaScriptOOP
    mui框架移动开发初体验
    走进AngularJS
  • 原文地址:https://www.cnblogs.com/haima/p/10265315.html
Copyright © 2011-2022 走看看