Vue's slots enable you to define where content of a component should land when you define the content inside of a parent component. You can also name slots to arrange the elements however you'd like and allow your component to build it's own content around the content that will be placed.

main.js:

import Vue from 'vue'
import App from './App.vue' new Vue({
render: (h) => (
<App>
<h1 slot="header">This is header</h1>
<h2 slot="footer">This is footer</h2>
</App>
)
}).$mount('#app')

App.vue:

<template>
<section class="section">
<slot name='header'></slot> <hello-world message="Message from APP"></hello-world> <slot name='footer'></slot>
</section>
</template>

[Vue @Component] Place Content in Components with Vue Slots的更多相关文章

  1. [Vue @Component] Pass Props Between Components with Vue Slot Scope & renderless component

    Components with slots can expose their data by passing it into the slot and exposing the data using  ...

  2. [Vue @Component] Handle Errors and Loading with Vue Async Components

    Because async components are not bundled with your app, they need to be loaded when requested. This ...

  3. vue-property-decorator 提供 OO 的风格 Vue Component 方便类型声明

    @Prop  父子组件之间传值 Install: npm install --save vue-property-decorator Child: <template> <div&g ...

  4. Vue.mixin Vue.extend(Vue.component)的原理与区别

    1.本文将讲述 方法 Vue.extend Vue.mixin 与 new Vue({mixins:[], extend:{}})的区别与原理 先回顾一下 Vue.mixin 官网如下描述: Vue. ...

  5. Vue Vue.use() / Vue.component / router-view

    Vue.use Vue.use 的作用是安装插件 Vue.use 接收一个参数 如果这个参数是函数的话,Vue.use 直接调用这个函数注册组件 如果这个参数是对象的话,Vue.use 将调用 ins ...

  6. [Vue @Component] Switch Between Vue Components with Dynamic Components

    A common scenario is to present different components based on the state of the application. Dynamic ...

  7. Vue报错之" [Vue warn]: Unknown custom element: <wzwzihello> - did you register the component correctly? For recursive components, make sure to provide the "name" option."

    一.报错截图 [Vue warn]: Unknown custom element: <wzwzihello> - did you register the component corre ...

  8. [Vue @Component] Extend Vue Components in TypeScript

    This lesson shows how you can extend and reuse logic in Vue components using TypeScript inheritance. ...

  9. [Vue @Component] Simplify Vue Components with vue-class-component

    While traditional Vue components require a data function which returns an object and a method object ...

随机推荐

  1. 附加数据库错误代码 - 950【MSSQL】

    分析 (539)代表的是Sql Server 2000数据库的内部版本号,也就是说要附加的数据库文件是由Sql Server 2000创建的,但是我们知道Sql Server 2016 数据库是不兼容 ...

  2. 创建对象——单例(Singleton)模式

      单例(Singleton)模式:   保证一个类在系统里只能有一个对象被实例化.   如:缓存池.数据库连接池.线程池.一些应用服务实例等.   难点:在多线程环境中,保证实例的唯一性.     ...

  3. P1334 瑞瑞的木板

    题目描述 瑞瑞想要亲自修复在他的一个小牧场周围的围栏.他测量栅栏并发现他需要N(1≤N≤20,000)根木板,每根的长度为整数Li(1≤Li≤50,000).于是,他神奇地买了一根足够长的木板,长度为 ...

  4. HTTP的报文格式、GET和POST格式解析

    1. HTTP报文格式 HTTP报文是面向文本的,报文中的每一个字段都是一些ASCII码串,各个字段的长度是不确定的.HTTP有两类报文:请求报文和响应报文.请求报文一个HTTP请求报文由请求行(re ...

  5. 关于加减和es6

    console.log(1+ "2"+"2");   //对于加法来说,如果只有一个操作数是字符串,则将另一个操作数也转换为字符串,然后将两者拼接,为122 c ...

  6. AVR单片机8位数码管显示的程序实现

    AVR单片机8位数码管显示的程序实现 转载:http://www.sohu.com/a/117255149_119709   2016-10-26 16:30 我们接着来完成 数码管的显示实验.现在我 ...

  7. 关于vue构建项目的一些指令

    第一步: brew install nodejs(MAC机子下)  Windows直接官网下载对应版本node.js 第二步: 获取nodejs模块安装目录访问权限(Windows系统忽略)sudo ...

  8. Codeforces_766_D_(并查集)

    D. Mahmoud and a Dictionary time limit per test 4 seconds memory limit per test 256 megabytes input ...

  9. 【原】thinkphp修改Redis操作类,支持选择数据库功能及添加其他方法

    版本3.2.2(ThinkPHP\Library\Think\Cache\Driver\Redis.class.php), 一:官方默认不支持选择数据库功能及,现就可选择数据库功能进行说明. 1 co ...

  10. Java基础——从数组到集合之间关键字的区别!!!!

    1.&& 和 &区别和联系: 相同点 : 结果是一样的.       不同点 :如果使用双&号判断,如果说条件一为false,不会判断条件二,但是单&号会继续判 ...