Vue Slots
子组件vue
<template>
<div>
<slot v-if="slots.header" name="header"></slot>
<slot></slot>
<slot name="footer"></slot>
</div>
</template>
<script>
export default {
mounted() {
console.log(this.$slots, '$slots')
},
computed: {
slots() {
return this.$slots
}
}
}
</script>
父组件vue
<template>
<div class="test">
<test>
<div slot="header">slot: header</div>
<div slot="header">slot: header</div>
<div>slot default</div>
<div slot="footer">slot: footer</div>
</test>
</div>
</template>
<script>
import Test from './test'
export default {
components: { Test },
}
</script>

Vue Slots的更多相关文章
- [Vue @Component] Place Content in Components with Vue Slots
Vue's slots enable you to define where content of a component should land when you define the conten ...
- 手写vue-router & 什么是Vue插件
博文分享 这篇文章你可以学习到: 实现一个自己的vue-router 了解什么是Vue的插件 学习b站大佬后做的笔记整理和源码实现 1.1.3一步一步带你弄懂vue-router核心原理及实现哔哩哔哩 ...
- (译文)开始学习Vue.js特性--Scoped Slots
什么是scoped slots A scoped slot is a special type of slot that functions as a reusable template (that ...
- vue 2.0 scopedSlots和slots在render函数中的应用示例
渲染内容为: hello from functional render scopedSlots render scopedSlots named slot of render hello from f ...
- 一例完全理解vue 2.0 的slots 和 functional render
https://jsfiddle.net/pronan/mjqpmw0u/ 通过调节plan="bbb"的值, 比如换成plan="children",你会发现 ...
- Vue.js 系列教程 2:组件,Props,Slots
原文:intro-to-vue-2-components-props-slots 译者:nzbin 这是关于 JavaScript 框架 Vue.js 五个教程的第二部分.在这一部分,我们将学习组件, ...
- Vue:渲染、指令、事件、组件、Props、Slots
如果要我用一句话描述使用 Vue 的经历,我可能会说“它如此合乎常理”或者“它提供给我需要的工具,而且没有妨碍我的工作”.每当学习 Vue 的时候,我都很高兴,因为很有意义,而且很优雅. 以上是我对 ...
- vue slot及用法,$slots访问具名slot
- Vue.js起手式+Vue小作品实战
本文是小羊根据Vue.js文档进行解读的第一篇文章,主要内容涵盖Vue.js的基础部分的知识的,文章顺序基本按照官方文档的顺序,每个知识点现附上代码,然后根据代码给予个人的一些理解,最后还放上在线编辑 ...
随机推荐
- Ethical Hacking - GAINING ACCESS(8)
Server Side Attacks NeXpose - configure and launch a scan Configure and initialize the application. ...
- faker生成器生成虚拟数据的Python模块
前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者:行哥 今天给大家介绍一个Faker模块,一款基于Python的测试数 ...
- vscode用MinGW和Clang配置C++环境
vscode是个不错的编辑器,简洁轻量,就是一开始的时候需要对环境进行配置,开个贴记录一下怎么用MingGW64+clang来配置. 下载地址 LLVM Download Page Pre-Built ...
- 从css属性和布局来说明一下,行类元素和行类块元素和块元素的区别
//布局 inline: 如果水平宽度足够大,那么将在一行显示 inline-block: 如果水平宽度足够大,那么将在一行显示 block: 独占一行 //css属性 inline: 无法设置高度, ...
- Apache常用配置详解
Apache配置文件:conf/httpd.conf.(注意:表示路径时使用‘/’而不使用‘\’,注释使用‘#’) 1. ServerRoot:服务器根目录,也就是Apache的安装目录,其他的目录配 ...
- Android TV 键盘样式开发
布局: <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=& ...
- Windows下使用图形化mount挂载磁盘到文件夹
Windows上也有类似于Linux上的mount命令,至于mount是什么: mount是Linux下的一个命令,它可以将分区挂接到Linux的一个文件夹下,从而将分区和该目录联系起来,因此我们只要 ...
- pandas | DataFrame基础运算以及空值填充
本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是pandas数据处理专题的第四篇文章,我们一起来聊聊DataFrame中的索引. 上一篇文章当中我们介绍了DataFrame数据结构当 ...
- Python List max()方法
描述 max() 方法返回列表元素中的最大值.高佣联盟 www.cgewang.com 语法 max()方法语法: max(list) 参数 list -- 要返回最大值的列表. 返回值 返回列表元素 ...
- PHP date_isodate_set() 函数
------------恢复内容开始------------ 实例 设置 2013 年第 5 周的 ISO 日期: <?php$date=date_create();date_isodate_s ...