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开发中,有许多流程,每个流程里都会有很多字段,比如流程标题.拉下选择,附件等等,有些是每个流程都会有的,有些是特有的,按常规的方法开发,就为为一个流程写一个表单,校验,提交.如果新来流 ...
随机推荐
- slice 切片实现 Slice object interface
1.Python切片对象可以为任意类型 https://github.com/python/cpython/blob/master/Include/sliceobject.h /* Slice obj ...
- LOJ10128. 花神游历各国
花神喜欢步行游历各国,顺便虐爆各地竞赛.花神有一条游览路线,它是线型的,也就是说,所有游历国家呈一条线的形状排列,花神对每个国家都有一个喜欢程度(当然花神并不一定喜欢所有国家). 每一次旅行中,花神会 ...
- Centos7部署FytSoa项目至Docker——第一步:安装Docker
FytSoa项目地址:https://gitee.com/feiyit/FytSoaCms 部署完成地址:http://82.156.127.60:8000/ 先到腾讯云申请一年的云服务器,我买的是一 ...
- (九)整合 ElasticSearch框架,实现高性能搜索引擎
整合 ElasticSearch框架,实现高性能搜索引擎 1.SpringBoot整合ElasticSearch 1.1 核心依赖 1.2 配置文件 1.3 实体类配置 1.4 数据交互层 1.5 演 ...
- HTML5 初学者一步一步攀爬 努力加油学习
Html 5 Html:Hyper Text MarKup Language超文本标签语言 Html:网页的源码 浏览器:"解释和执行"HTMl源码的工具 Head 标签内的信息用 ...
- Mycat安装并实现mysql读写分离,分库分表
Mycat安装并实现mysql读写分离,分库分表 一.安装Mycat 1.1 创建文件夹 1.2 下载 二.mycat具体配置 2.1 server.xml 2.2 schema.xml 2.3 se ...
- ACCESS手注
ASP一般搭载ACCESS或者mssql 判断数据库类型 http://www.***.com?id=1 and (select count(*) from sysobjects)>0 http ...
- yuan先生博客地址
1 Web应用 https://www.cnblogs.com/yuanchenqi/articles/8869302.html2 http协议 https://www.cnblogs.com/yu ...
- k8s command & args
命令和参数说明: command.args两项实现覆盖Dockerfile中ENTRYPOINT的功能,具体的command命令代替ENTRYPOINT的命令行,args代表集体的参数. 如果comm ...
- Event Sourcing落地与意义
jsoncat:https://github.com/Snailclimb/jsoncat (仿 Spring Boot 但不同于 Spring Boot 的一个轻量级的 HTTP 框架) 高内聚低耦 ...