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的更多相关文章

  1. Vuejs之Component slot 插槽详解

    Vuejs的component的数据进行了沙箱隔离,除js全局变量如Math, Date之类外无法访问用户自定义的变量,所以使用component写组件或嵌套组件时明白变量的访问非常重要 编译作用域 ...

  2. vue-eleme 学习笔记

     # watch 用法 (1).普通的watch <div style="margin-top: 60px;"> {{common}} <button @clic ...

  3. Render Functions & JSX

    Render Functions & JSX Basics Vue recommends using templates to build your HTML in the vast majo ...

  4. Laravel框架中Blade模板的用法

    1. 继承.片段.占位.组件.插槽 1.1 继承 1.定义父模板 Laravel/resources/views/base.blade.php 2.子模板继承 @extends('base') 1.2 ...

  5. vue render function

    vue render function https://vuejs.org/v2/guide/render-function.html { // Same API as `v-bind:class`, ...

  6. vue前端开发那些事——vue组件开发

    vue的学习曲线不是很陡(相比其它框架,如anglarjs),官方文档比较全面,分为基础篇和高级篇.我们刚开始学习的时候,肯定像引用jquery那样,先把vue的js引进来,然后学习基础内容.如果仅仅 ...

  7. component and slot

    component and slot 使用: 1.component panel <article class="message"> <div class=&qu ...

  8. [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  ...

  9. 用slot和component实现表单共用

    业务需求 在oa开发中,有许多流程,每个流程里都会有很多字段,比如流程标题.拉下选择,附件等等,有些是每个流程都会有的,有些是特有的,按常规的方法开发,就为为一个流程写一个表单,校验,提交.如果新来流 ...

随机推荐

  1. cms_文章管理

    文章管理 文章管理前端页面 把引入的多个布局抽成了公共代码 <%@ page language="java" contentType="text/html; cha ...

  2. URL重定向漏洞解析

    参考文章 悟空云课堂 | 第二期:URL重定向(跳转)漏洞 CWE-601: URL Redirection to Untrusted Site ('Open Redirect') 分享几个绕过URL ...

  3. 重绘和回流(Repaint & Reflow)总结,以及如何进行优化

    1. 浏览器渲染机制 浏览器采用流式布局模型(Flow Based Layout) 浏览器会把HTML解析成DOM,把CSS解析成CSSOM,DOM和CSSOM合并就产生了渲染树(Render Tre ...

  4. Linux环境Hadoop安装配置

    Linux环境Hadoop安装配置 1. 准备工作 (1)linux配置IP(NAT模式) (2)linux关闭防火墙 (3)设置主机名 (4)设置映射 (5)设置免密登录 2. 安装jdk (1)上 ...

  5. 使用Docker Compose编排Spring Cloud微服务

    文章目录 微服务构建实例 简化Compose的编写 编排高可用的Eureka Server 编排高可用Spring Cloud微服务集群及动态伸缩 微服务项目名称 项目微服务中的角色 microser ...

  6. PHP-文件、目录相关操作

    PHP-文件.目录相关操作 一  目录操作(Directory 函数允许获得关于目录及其内容的信息) 相关函数: 函数 描述 chdir() 改变当前的目录. chroot() 改变根目录. clos ...

  7. Flink-v1.12官方网站翻译-P022-Working with State

    有状态程序 在本节中,您将了解Flink为编写有状态程序提供的API.请看一下Stateful Stream Processing来了解有状态流处理背后的概念. 带键值的数据流 如果要使用键控状态,首 ...

  8. [NC13331]城市网络

    传送门 题意: 思路: 对于每组查询,我们直接从$u$往上搜到$v$,复杂度$O(nq)$,显然不可取(不过这题开始的数据很弱,暴力就过了) #include<bits/stdc++.h> ...

  9. getline()的使用注意

    在使用getline读入一整行时,若是前面是使用getchar().cin这类读入了一个字母,但是不会读入后续换行\n符号或者空格的输入时,再接getline()就容易出现问题. 这是因为输入数字之后 ...

  10. 数组复制函数memcpy和strcpy

    strcpy和memcpy主要有以下3方面的区别.1.复制的内容不同.strcpy只能复制字符串,而memcpy可以复制任意内容,例如字符数组.整型.结构体.类等.2.复制的方法不同.strcpy不需 ...