antd modal 拖动_Package - antd-draggable-modal

本文介绍如何使用antd-draggable-modal库创建可拖拽的Ant Design Modal窗口。该组件支持居中打开、拖拽标题栏以及多层弹窗拖拽功能。通过安装和引入组件,配合基本的React代码,即可实现弹窗的拖动效果。
摘要由CSDN通过智能技术生成

基于Ant-design的可以拖拽的Modal

基于Ant-design的可以拖拽的Modal

16dc8af974a0f5761cf97c74df55e772.gif

特性:

支持弹出窗居中打开

支持拖拽 title bar 实现拖拽

支持多层弹窗拖拽

安装:

$ yarn add antd-draggable-modal

用法:

import React, { Component } from 'react';

import { Button } from 'antd';

import AntdDraggableModal from 'antd-draggable-modal';

class Index extends Component {

state = {

visible: false,

visible2: false,

}

handleVisible = visible => {

this.setState({

visible,

});

}

handleOk = () => {

this.handleVisible(false);

}

handleCancel = () => {

this.handleVisible(false);

}

render() {

return (

<>

this.handleVisible(true)}>打开弹窗

{this.state.visible && (

title="Basic Modal"

visible={this.state.visible}

onOk={this.handleOk}

onCancel={this.handleCancel}

>

Some contents...

Some contents...

Some contents...

this.setState({ visible2: true })}>打开弹窗2

)}

{this.state.visible2 && (

title="Basic Modal2"

visible={this.state.visible2}

onOk={() => this.setState({ visible2: false })}

onCancel={() => this.setState({ visible2: false })}

>

Some contents...

Some contents...

Some contents...

)}

>

);

}

}

export default Index;

Current Tags

0.1.7                                ...           latest (a year ago)

8 Versions

0.1.7                                ...           a year ago

0.1.6                                ...           a year ago

0.1.5                                ...           a year ago

0.1.4                                ...           a year ago

0.1.3                                ...           a year ago

0.1.2                                ...           a year ago

0.1.1                                ...           a year ago

0.1.0                                ...           a year ago

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值