首页 > 其他 > 详细

组件的内容分发

时间:2018-12-04 16:26:41      阅读:148      评论:0      收藏:0      [点我收藏+]

组件标签的内容取出来使用:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>

</head>

<body>
<div id="app">
    <neirong>这是组件内容
        <ul slot="s1">
            <li>aaaaaaa</li>
        </ul>



        <ol slot="s2">
            <ul>
                bbbbb
            </ul>
        </ol>

    </neirong>
</div>

<template id="neirong">
    <div>
        <slot name="s2"></slot>
        <h1>sdfasf</h1>
    </div>
</template>


</body>

<script>

    new Vue({
        el: "#app",
        components:{
            'neirong':{
                template: "#neirong"
            }
        }
    })


</script>
</html>

组件的内容分发

原文:https://www.cnblogs.com/wspblog/p/10064641.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!