首页 > 其他 > 详细

vvv,具名插槽

时间:2021-06-16 22:28:51      阅读:20      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
    <head>
        
        <script src="a.js"></script>
    </head>
    <body>
        <div id="root"></div>
    </body>
<script>

const app = Vue.createApp({
    template:`
    <layout>
        <template v-slot:header>
            <div>header</div>
        </template>
        <template v-slot:footer>
            <div>footer</div>
        </template>
    </layout>
    `
})
app.component(layout,{
    template:`
        <div>
            <slot name="header"></slot>
            <div>content</div>
            <slot name="footer"></slot>
        </div>
    `
})
const vm = app.mount(#root)
</script>
</html>

 

vvv,具名插槽

原文:https://www.cnblogs.com/lfhphp/p/14890059.html

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