component & slot
component & slot
<template>
<div class="myHeaderContainer">
<header class="myHeader" :class="{ 'fixed': fixed }">
<div class="top_bar">
<div class="abs_l">
<slot name="left">
<a slot="left" class="back-white" @click.stop="back"></a>
</slot>
</div>
<div class="abs_m">
{{title}}
<slot name="mid"></slot>
</div>
<div class="abs_r">
<slot name="right"></slot>
</div>
</div>
</header>
</div>
</template>
<script>
import LightSDK from "light-sdk";
export default {
props: {
fixed: Boolean,
title: String
},
methods: {
back() {
LightSDK.native.back({ number: "1" });
}
}
};
</script>
<style lang='less' scoped>
// header_height = 1.335rem
.myHeaderContainer {
height: 0.86rem;
}
.myHeader {
display: block;
position: relative;
overflow: hidden;
background-color: #1a90ff;
color: #fff;
font-size: 16px;
&.fixed {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 666;
}
.top_bar {
position: relative;
height: 0.86rem;
user-select: none;
display: flex;
align-items: center;
a {
display: table-cell;
width: 0.86rem;
height: 0.86rem;
color: inherit;
font-size: inherit;
font-weight: inherit;
text-decoration: none;
vertical-align: middle;
}
.abs_l,
.abs_r {
width: 0.86rem;
height: 0.86rem;
font-size: inherit;
color: inherit;
text-align: center;
}
.abs_m {
flex: 1;
font-weight: 700;
text-align: center;
}
}
}
</style>
demo
<my-header
fixed
title="名片夹">
<span slot="right"
v-if="isShowBusiness && selected === `2`"
class="chat-header-icon chat-header-search"
@click="handleSearch"
ref="chat-search">
</span>
</my-header>

demos
refs
https://www.cnblogs.com/xgqfrms/p/10979925.html
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
component & slot的更多相关文章
- Vuejs之Component slot 插槽详解
Vuejs的component的数据进行了沙箱隔离,除js全局变量如Math, Date之类外无法访问用户自定义的变量,所以使用component写组件或嵌套组件时明白变量的访问非常重要 编译作用域 ...
- vue-eleme 学习笔记
# watch 用法 (1).普通的watch <div style="margin-top: 60px;"> {{common}} <button @clic ...
- Render Functions & JSX
Render Functions & JSX Basics Vue recommends using templates to build your HTML in the vast majo ...
- Laravel框架中Blade模板的用法
1. 继承.片段.占位.组件.插槽 1.1 继承 1.定义父模板 Laravel/resources/views/base.blade.php 2.子模板继承 @extends('base') 1.2 ...
- vue render function
vue render function https://vuejs.org/v2/guide/render-function.html { // Same API as `v-bind:class`, ...
- vue前端开发那些事——vue组件开发
vue的学习曲线不是很陡(相比其它框架,如anglarjs),官方文档比较全面,分为基础篇和高级篇.我们刚开始学习的时候,肯定像引用jquery那样,先把vue的js引进来,然后学习基础内容.如果仅仅 ...
- component and slot
component and slot 使用: 1.component panel <article class="message"> <div class=&qu ...
- [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 ...
- 用slot和component实现表单共用
业务需求 在oa开发中,有许多流程,每个流程里都会有很多字段,比如流程标题.拉下选择,附件等等,有些是每个流程都会有的,有些是特有的,按常规的方法开发,就为为一个流程写一个表单,校验,提交.如果新来流 ...
随机推荐
- 入 Go 必读:大型Go工程的项目结构及实战思考 原创 毛剑 QCon 今天
入 Go 必读:大型Go工程的项目结构及实战思考 原创 毛剑 QCon 今天
- Mysql,Oracle与Java字段类型映射关系
Mysql,Oracle与Java字段类型映射关系 参考相关博文 MySQL/Oracle字段类型 Java字段类型 最大长度 BIT java.lang.Boolean 1 BLOB java.la ...
- C链表-C语言入门经典例题
struct student { long num; float score; struct student *next; }; 注意:只是定义了一个struct student类型,并未实际分配存储 ...
- centos6.5 更新python2.6.6至2.7.6
1.查看当前Python版本 # python -V Python 2.6.6 2.下载Python2.7.6源码 # wget http://python.org/ftp/p ...
- (13)Linux文件系统的优缺点
通过文件系统的方式来组织磁盘存储和数据管理.有以下几个方面的好处. 数据的读取.管理操作变得简单 文件系统给用户提供了一个简单的操作界面,用户可以通过对文件系统的简单操作,实现对磁盘的管理.虽然 Li ...
- 彻底搞懂Cookie、Session、Token到底是什么
洛:大爷,楼上322住的是马冬梅家吧? 大爷:马都什么? 夏洛:马冬梅. 大爷:什么都没啊? 夏洛:马冬梅啊. 大爷:马什么没? 夏洛:行,大爷你先凉快着吧. 在了解这三个概念之前我们先要了解HTTP ...
- 纯js添加类
1.el.setAttribute('class','abc'); <!DOCTYPE HTML><HTML><HEAD><meta charset=&quo ...
- C语言简介与第一个C语言程序
一.C语言产生的背景 C语言的出现与操作系统Unix是分不开的.Unix是1969年由美国贝尔实验室的K. Thompson和D. M. Ritchie两人用汇编语言编写,它存在许多不足,因此,需要一 ...
- vue后台管理系统遇到的注意事项以及总结
地址栏加#号问题:Vue-router 中有hash模式和history模式,vue的路由默认是hash模式,一般开发的单页应用的URL都会带有#号的hash模式第一步在router/index.js ...
- 【uva 753】A Plug for UNIX(图论--网络流最大流 Dinic)
题意:有N个插头,M个设备和K种转换器.要求插的设备尽量多,问最少剩几个不匹配的设备. 解法:给读入的各种插头编个号,源点到设备.设备通过转换器到插头.插头到汇点各自建一条容量为1的边.跑一次最大流就 ...