其他分享
首页 > 其他分享> > solt具名插槽

solt具名插槽

作者:互联网

<!DOCTYPE html> <html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script> <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.css" rel="stylesheet"> <link href="https://cdn.bootcss.com/animate.css/3.7.1/animate.css" rel="stylesheet"> <style>


</style> </head>
<body> <div id="app"> <h1 slot='two'>具名插槽1</h1> <index>首页</index> <h2 slot='one'>具名插槽2</h2>
</div>

<script> Vue.component('index', { template: ` <div> <slot name='two'></slot> <span>插槽</span> <slot name='one'></slot> </div>` }) var vm = new Vue({ el: '#app', data: { flag: true },



}); </script>
</body>
</html>

标签:el,Vue,index,插槽,具名,solt,true
来源: https://www.cnblogs.com/xiannv/p/10995182.html