Vue全局API-template模板

template模板

<body>
    <h1>Template 三种写法<h1>
    <hr>
    <div id="app">
        {{message}}
    </div>

    <!-- 1-选项模板 -->
    <template></template>

    <!-- 2-标签模板-->
    <template id="dd2">
        <h2 style="color:red">我是Template标签模板</h2>
    </template>

    <!-- 3-可以外部引用-->
    <script type="x-template" id="dd3">
        <h2 style="color:red">我是Script标签模板</h2>
    </script>

    <script type="text/javascript">
        var app = new Vue({
            el:'#app',
            data:{
                message:'hello world!'
            },
             //1-选项模板
             //template:`<h2 style="color:red">我是选项模板</h2>`//~波浪线的按键

            //template:"#dd2",
            template:"#dd3",
        })
    </script>
</body>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容