• 谷粒学院_day03_vue组件


    组件的作用就是用来将一些可以复用的代码抽取出来的,有单页面组件和全局组件,单页面组件的话是定义在一个html页面的,只能本页面使用;而全局组件是定义在单独的js文件中,只要引入该js文件,就能使用该组件了

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    
    <body>
        <div id="app">
            <component1></component1>
            <component2></component2>
        </div>
        <script src="jsvue.min.js"></script>
        <script src="components/navbar.js"></script>
        <script>
            new Vue({
                el: '#app',
                data: {
                    
                },
                components: {
                    'component1':{
                        template:'<h1>我很牛逼</h1>'
                    }
                }
            })
        </script>
    </body>
    
    </html>
    navbar.js文件:
    Vue.component('component2',{
        template: '<ul><li>huya</li><li>douyu</li></ul>'
    })
     
  • 相关阅读:
    set-find
    set-equal_range
    set-equal_range
    set-erase
    php 抽象类 静态 单体设计模式
    Servlet 工作原理解析
    职场上一个人情商高的十种表现
    快速学习一门新技术入门
    php中14中排序方式的实现
    php中对Mysql数据库的访问操作
  • 原文地址:https://www.cnblogs.com/ibcdwx/p/14126776.html
Copyright © 2020-2023  润新知