GithubHelp home page GithubHelp logo

rax-modal's Introduction

npm

描述

rax-modal 提供了弹出遮罩层的能力,为 Alert, Confirm 等对话框组件提供底层能力。

安装

$ npm install rax-modal --save

引用

import RaxModal from 'rax-modal';

属性

属性 类型 默认值 ** 必填 ** 描述 ** 支持 **
visible boolean undefined true 控制弹层是否显示 browser weex
contentStyle Object undefined false 自定义内容容器样式 browser weex
onShow Function undefined false 当弹层显示的时候触发回调 browser weex
onHide Function undefined false 当弹层关闭的时候触发回调 browser weex
maskCanBeClick boolean true false 是否可以通过点击背景蒙层关闭弹层 browser weex
delay number 0 false 延迟,毫秒 browser weex
duration number 或者 [number, number] [300, 300] false 动画持续时间(毫秒), 如果是数组,则分别表示打卡动画时间和关闭动画时间 browser weex

注:支持列表中的 browser 代表h5 weex 代表weex miniApp 代表小程序

示例

import {createElement, Component, render} from 'rax';
import Modal from 'rax-modal';

const Demo = (props) => {
  const [visible, setVisible] = useState(false);
  return ([
      <View onClick={() => setVisible(true)}><Text>open</Text></View>,
      <Modal
        visible={visible}
        onHide={() => {
          setVisible(false)
        }}
        onShow ={() => {
          setVisible(true)
        }}
        maskCanBeClick={true}
        contentStyle={{
          position: "absolute",
          top: "150rpx",
          width: "400rpx",
          left: "175rpx"
        }}
        >
        <Text>这里是弹窗内容</Text>
      </Modal>
  ]);
}

render(<Demo />);

rax-modal's People

Contributors

lihongxun945 avatar yacheng avatar recover758126 avatar yuanyan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.