其他分享
首页 > 其他分享> > vvv,具名插槽

vvv,具名插槽

作者:互联网

<!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>

 

标签:Vue,const,footer,vvv,具名,template,插槽,app
来源: https://www.cnblogs.com/lfhphp/p/14890059.html