6.VUE起步,组件1

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="root">
        <table>
            <tbody>
                <tr is="row"></tr>//is属性,代表这个渲染的是row
                <tr is="row"></tr>
            </tbody>

        </table>

    </div>
    <script>
        Vue.component("row",{
            data:function(){//component里面的data必须是函数的形式
                return{
                    concent:'This is a row'
                }
            },
            template:"<tr><td>{{concent}}<td><tr>"

        })
        var vm=new Vue({
            el:"#root"


        })
    </script>
</body>
</html>
原文地址:https://www.cnblogs.com/tilyougogannbare666/p/14376943.html