基于taro封装底下浮动弹窗组件
先看效果图:

jsx:
import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import closeImg from '../../images/icons/close.png'
import './FloatLayout.scss'
interface IProps {
isOpened: boolean,
onClose: Function,
title: string,
}
class FloatLayout extends Component<IProps, {}> {
state = {
}
handleClose () {
this.props.onClose()
}
render () {
const {isOpened, title} = this.props
return (
<View className={isOpened ? "float-layout active" : "float-layout"}>
<View className='float-layout__overlay' onClick={this.handleClose.bind(this)}></View>
<View className='float-layout__container layout'>
<View className='layout-header xmg-border-b'>
{title}
<Image src={closeImg} className='close-img'/>
</View>
<View className='layout-body'>
{this.props.children}
</View>
</View>
</View>
)
}
}
export { FloatLayout }
scss:
.flolayout {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
visibility: hidden;
z-index: 810;
transition: visibility 300ms cubic-bezier(0.36, 0.66, 0.04, 1);
&.active {
visibility: visible;
.flolayout__overlay {
opacity: 1;
}
.flolayout__container {
transform: translate3d(0, 0, 0);
}
}
}
.flolayout__overlay {
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
background-color: rgba(0, 0, 0, 0.3);
opacity: 0;
transition: opacity 150ms ease-in;
}
.flolayout__container {
position: absolute;
bottom: 0;
width: 100%;
min-height: 600px;
max-height: 950px;
background-color: #fff;
border-radius: 32px 32px 0px 0px;
transform: translate3d(0, 100%, 0);
transition: -webkit-transform 300ms cubic-bezier(0.36, 0.66, 0.04, 1);
transition: transform 300ms cubic-bezier(0.36, 0.66, 0.04, 1);
transition: transform 300ms cubic-bezier(0.36, 0.66, 0.04, 1),
-webkit-transform 300ms cubic-bezier(0.36, 0.66, 0.04, 1);
}
.flolayout .layout-header {
position: relative;
padding: 30px 0;
text-align: center;
.close-img {
position: absolute;
right: 28px;
top: 36px;
width: 36px;
height: 36px;
}
}
.flolayout .layout-header__title {
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
color: #333;
font-size: 32px;
display: block;
padding-right: 80px;
}
.flolayout .layout-header__icon {
line-height: 1;
position: absolute;
top: 50%;
right: 18px;
padding: 10px;
transform: translate(0, -50%);
}
.flolayout .layout-body {
font-size: 28px;
padding: 20px;
height: 602px;
}
.flolayout .layout-body__content {
position: relative;
height: 500px;
overflow-y: scroll;
}
组件必须传三个参数,
isOpened: boolean, //控制显示
onClose: Function, //处理关闭弹窗逻辑
title: string //标题
基于taro封装底下浮动弹窗组件的更多相关文章
- 基于 React 封装的高德地图组件,帮助你轻松的接入地图到 React 项目中。
react-amap 这是一个基于 React 封装的高德地图组件,帮助你轻松的接入地图到 React 项目中. 文档实例预览: Github Web | Gitee Web 特性 ️ 自动加载高德地 ...
- taro-script 0.4 发布,基于Taro v3的js解释器组件
taro-script Github地址 基于Taro v3开发,支持多端小程序动态加载远程 JavaScript 脚本并执行,支持 ES5 语法 最近更新内容 新增useScriptContext获 ...
- 基于ElementUI封装Excel数据导入组件
由于前端项目使用的是Vue-cli3.0 + TypeScript的架构,所以该组件也是基于ts语法封装的,组件的完整代码如下: <template> <div id="m ...
- 基于element-ui封装一个Table模板组件
大家在做后台管理系统的时候,写的最多的可能就是表格页面了,一般分三部分:搜索功能区.表格内容区和分页器区.一般这些功能都是使用第三方组件库实现,比如说element-ui,或者vuetify.这两个组 ...
- Vue.js(24)之 弹窗组件封装
同事封装了一个弹窗组件,觉得还不错,直接拿来用了: gif图展示: 弹框组件代码: <template> <transition name="confirm-fade&qu ...
- 基于vue-simple-uploader封装文件分片上传、秒传及断点续传的全局上传插件
目录 1. 前言 2. 关于vue-simple-uploader 3. 基于vue-simple-uploader封装全局上传组件 4. 文件上传流程概览 5. 文件分片 6. MD5的计算过程 7 ...
- 基于JQ的自定义弹窗组件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 封装React AntD的dialog弹窗组件
前一段时间分享了基于vue和element所封装的弹窗组件(封装Vue Element的dialog弹窗组件),今天就来分享一个基于react和antD所封装的弹窗组件,反正所使用的技术还是那个技术, ...
- 基于highcharts封装的组件-demo&源码
前段时间做的项目中需要用到highcharts绘制各种图表,其实绘制图表本身代码很简单,但是由于需求很多,有大量的图形需要绘制,所以就不得不复制粘贴大量重复(默认配置等等)的代码,所以,后来抽空自己基 ...
随机推荐
- 以太网MAC地址组成与交换机基本知识
以太网MAC地址 MAC地址由48位二进制组成,通常分为六段,用十六进制表示,工作在数据链路层. 数据链路层功能: 链路的建立,维护与拆除 帧包装,帧传输,帧同步 帧的差错恢复 简单的流量控制 第八位 ...
- k8s之deployment详解
Deployment介绍 为了更好地解决服务编排的问题,k8s在V1.2版本开始,引入了deployment控制器,值得一提的是,这种控制器并不直接管理pod, 而是通过管理replicaset来间接 ...
- C语言:条件编译
假如现在要开发一个C语言程序,让它输出红色的文字,并且要求跨平台,在 Windows 和 Linux 下都能运行,怎么办呢?这个程序的难点在于,不同平台下控制文字颜色的代码不一样,我们必须要能够识别出 ...
- Java基础00-字符串14
1. API 1.1 API概述 2. String String常用类的常用方法 String字符串变量的创建: 声明: String 变量名; String str; 声明并初始化: Str ...
- MapReduce学习总结之架构
一.MapReduce1.x架构 1)jobTracker:JT 作业的管理者 将作业分解成一堆任务:Task(MapTask和ReduceTask) 将任务分派给TaskTracker(TT)运行 ...
- java并发编程基础——线程池
线程池 由于启动一个线程要与操作系统交互,所以系统启动一个新的线程的成本是比较高的.在这种情况下,使用线程池可以很好的提升性能,特别是程序中涉及创建大量生命周期很短暂的线程时. 与数据库连接池类似,线 ...
- windows系统显示文字编码的CMD命令
chcp命令,显示.设置系统文字编码格式.
- 微信小程序云开发-数据库-获取用户添加的数据到数据库
一.列表页面新增[添加商品]按钮 在列表页增加[添加商品]按钮,按钮绑定事件toAdd(),用户点击该按钮跳转到添加商品页面. 在js文件中写toAdd()函数,作用是点击[添加商品]按钮,跳转到[添 ...
- 2021 NOI冬令营
2021 NOI冬令营 -- 本来想写得稍微文艺一点的,但是停课这么久已经退化到不会写文章了. 毕竟省选了我才来补的,时间也过去很久了. 毕竟这次我没有获得任何奖项. 我唯一的获得就是-- --好好看 ...
- mysql jdbc8.0连接mysql