SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html lang="en">

<head>
    <title>component props 属性设置</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>

<body>
    <h1>component props 属性设置</h1>
    <hr>
    <div id="app">
        <panda :from-here="message"></panda>
    </div>

    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data:{
                message:"China"
            },
            components: { //局部组件可以定义多个,所以使用components,全局组件只能一个一个定义,所以使用component
                "panda": {
                    template: `<div style="color:green">Panda from {{fromHere}}</div>`,
                    props:["fromHere"]
                }
            }
        })
    </script>
</body>

</html>

本项目引用的自定义外部资源