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开发中,有许多流程,每个流程里都会有很多字段,比如流程标题.拉下选择,附件等等,有些是每个流程都会有的,有些是特有的,按常规的方法开发,就为为一个流程写一个表单,校验,提交.如果新来流 ...
随机推荐
- Docker容器内中文乱码
Docker容器内中文乱码 一.通过Dockerfile解决中文乱码问题 方式二: 二.临时解决 方式二: 三.修改jre/lib/fonts下的字体 CSDN:黑猫_:Dockerfile 创建容器 ...
- Tomcat 详解URL请求
这里分析一个实际的请求是如何在Tomcat中被处理的,以及最后是怎么样找到要处理的Servlet的?当我们在浏览器中输入http://hostname:port/contextPath/servlet ...
- ubuntu 安装新版的qq,可支持下载文件等常用功能
说明:此版本的QQ基本完美,但是有个缺点就是历史记录有些会显示乱码! 注意:此方法能完美解决这篇文章http://www.cnblogs.com/EasonJim/p/7118693.html的所有问 ...
- 当前日期减去TIMESTAMP(6)日期
select trunc(sysdate- to_date(to_char(j.create_date,'yyyy-mm-dd'),'yyyy-mm-dd')) 相差天数 from sys_user ...
- Spring3文件上传,提速你的Web开发
Spring1 推出的时候可以说是不小的颠覆了J2EE 的开发,彻底把EJB打败,将J2EE开发进行简化,Spring2 推出以后完美的与多种开源框架与服务器的结合,让你对其拥抱的更紧,Spring变 ...
- ceph ---(ceph简介)
ceph简介: Ceph是一种为优秀的性能.可靠性和可扩展性而设计的统一的.分布式文件系统.ceph 的统一体现在可以提供文件系统.块存储和对象存储,分布式体现在可以动态扩展.在国内一些公司的云环境中 ...
- 6127:Largest Average
#include<bits/stdc++.h> using namespace std; int a[100001]; double ave[100001]; struct student ...
- 线程不安全(Arraylist,HashSet,HashMap)和写时复制
package com.yangyuanyuan.juc1205; import java.util.List; import java.util.Map; import java.util.Set; ...
- B - 规律题2
10 123456 1:f(y)=1+2+3+4+5+6=21 2:f(y)=3 3 3 b进制,<b; 10 123 1+2+3=6;是3的倍数 1234 =(999)*1+99 ...
- AtCoder Beginner Contest 176 E - Bomber (思维)
题意:有一张\(H\)x\(W\)的图,给你\(M\)个目标的位置,你可以在图中放置一枚炸弹,炸弹可以摧毁所在的那一行和一列,问最多可以摧毁多少目标. 题解:首先我们记录某一行和某一列目标最多的数目, ...