• Component 组件props 属性设置


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Component 组件props 属性设置</title>
        <meta name="flexible" content="initial-dpr=2,maximum-dpr=3" />
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta content="yes" name="apple-touch-fullscreen">
         <meta content="telephone=no,email=no" name="format-detection">
        <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
        <script src="../assets/js/flexible_css.js"></script>
        <script src="../assets/js/flexible.js"></script>
        <script src="../assets/js/vue.js"></script>
    </head>
    <body>
    
        <div id="app">
            <caicai here="China"></caicai>
            <caicai :here="message"></caicai>   <!--第二种方式:通过  v-bind方法  :here 是简写   把构造器中data的值传递给组件-->  
        </div>
    </body>
    <script type="text/javascript">
        var app=new Vue({
                el:"#app",
                data:{
                    message:"liao ning",
                },
                components:{
                    "caicai":{
                        template:`<div style="color:green">I'm  from {{here}}</div>`,  //{{here}}组件的模板里读出属性值
                        props:['here']  //props 支撑 支持   使倚靠在某物上;//here 属性  传递china  值给组件
                    }
                }
                
    
        })
        ////  vue不支持  带 -  命名方式    可以小城驼峰形式(第二个单词首字母大写)  大驼峰 (从第一个单词开始,每个单词首字母都大写)
    </script>
    </html>
  • 相关阅读:
    野生前端的数据结构基础练习(3)——链表
    野生前端的数据结构基础练习(3)——链表
    野生前端的数据结构基础练习(3)——链表
    Spring MVC之LocaleResolver详解
    Winfrom 屏蔽Alt+F4
    最简单的单例模式
    Eclipse的优化
    Eclipse的优化
    用PULL解析器解析XML文件
    用PULL解析器解析XML文件
  • 原文地址:https://www.cnblogs.com/jinsuo/p/8481451.html
Copyright © 2020-2023  润新知