message-verify 0.0.32-beta.0 → 0.0.34-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -4
- package/dist/index.js +17 -35
- package/dist/main.js +7 -2
- package/package.json +1 -1
- package/src/index.tsx +30 -49
- package/src/main.tsx +8 -2
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
export type ModalConfig = {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
data: {
|
3
|
+
mobile: string;
|
4
|
+
verifyCodeKey: string;
|
5
|
+
sendSuccess: boolean;
|
6
|
+
};
|
5
7
|
onClose?: () => void;
|
6
8
|
};
|
7
|
-
export declare const
|
9
|
+
export declare const createMessageVerifyModal: (config: ModalConfig) => void;
|
package/dist/index.js
CHANGED
@@ -1,45 +1,27 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
// import App from './app.js';
|
3
|
-
// import { createRoot } from 'react-dom/client';
|
4
|
-
// interface Props {
|
5
|
-
// data: {
|
6
|
-
// mobile: string;
|
7
|
-
// verifyCodeKey: string;
|
8
|
-
// sendSuccess: boolean;
|
9
|
-
// };
|
10
|
-
// refresh: () => void;
|
11
|
-
// isShow: boolean;
|
12
|
-
// }
|
13
|
-
// function createMessageVerify(props: Props) {
|
14
|
-
// // 创建一个挂载点
|
15
|
-
// const container = document.createElement('div');
|
16
|
-
// document.body.appendChild(container);
|
17
|
-
// // 渲染弹窗
|
18
|
-
// const root = createRoot(container);
|
19
|
-
// // 这里 isShow 直接传 true,弹窗立即显示
|
20
|
-
// root.render(<App {...props} isShow={true} />);
|
21
|
-
// // 可选:返回关闭方法
|
22
|
-
// return {
|
23
|
-
// destroy: () => {
|
24
|
-
// root.unmount();
|
25
|
-
// document.body.removeChild(container);
|
26
|
-
// }
|
27
|
-
// };
|
28
|
-
// }
|
29
|
-
// export { createMessageVerify };
|
30
|
-
// export default createMessageVerify;
|
31
|
-
// src/modal.tsx
|
32
|
-
// src/modal.tsx
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
33
2
|
import Modal from './compoments/modal.js';
|
34
3
|
import ReactDOM from 'react-dom/client';
|
4
|
+
import { useEffect, useState } from 'react';
|
35
5
|
let modalRoot = null;
|
36
|
-
const
|
37
|
-
|
6
|
+
const ModalDom = ({ config }) => {
|
7
|
+
const [visible, setVisible] = useState(true);
|
8
|
+
const { data } = config || {};
|
9
|
+
const { mobile } = data || {};
|
10
|
+
useEffect(() => {
|
11
|
+
console.log('mobile', mobile);
|
12
|
+
}, []);
|
13
|
+
return (_jsx(Modal, { visible: visible, onClose: () => {
|
14
|
+
setVisible(false);
|
15
|
+
config.onClose?.();
|
16
|
+
}, children: _jsxs("div", { children: ["\u5DF2\u53D1\u9001\u77ED\u4FE1\u81F3\u60A8\u7684\u624B\u673A\uFF1A", mobile] }) }));
|
17
|
+
};
|
18
|
+
// ... existing code ...
|
19
|
+
export const createMessageVerifyModal = (config) => {
|
38
20
|
const container = document.createElement('div');
|
39
21
|
container.id = 'antd-modal-container';
|
40
22
|
document.body.appendChild(container);
|
41
23
|
modalRoot = ReactDOM.createRoot(container);
|
42
|
-
modalRoot.render(_jsx(
|
24
|
+
modalRoot.render(_jsx(ModalDom, { config: {
|
43
25
|
...config,
|
44
26
|
onClose: () => {
|
45
27
|
config.onClose?.();
|
package/dist/main.js
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { createRoot } from 'react-dom/client';
|
3
|
-
import {
|
4
|
-
|
3
|
+
import { createMessageVerifyModal } from './index.js'; // 或 './index'
|
4
|
+
const data = {
|
5
|
+
mobile: '185****7760',
|
6
|
+
verifyCodeKey: 'e381c5f9-c7f4-4bf1-a948-744334fb0203',
|
7
|
+
sendSuccess: true
|
8
|
+
};
|
9
|
+
createRoot(document.getElementById('root')).render(_jsx("button", { onClick: () => createMessageVerifyModal({ data }), children: "Show Modal" }));
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
@@ -1,68 +1,49 @@
|
|
1
|
-
// import App from './app.js';
|
2
|
-
// import { createRoot } from 'react-dom/client';
|
3
|
-
|
4
|
-
// interface Props {
|
5
|
-
// data: {
|
6
|
-
// mobile: string;
|
7
|
-
// verifyCodeKey: string;
|
8
|
-
// sendSuccess: boolean;
|
9
|
-
// };
|
10
|
-
// refresh: () => void;
|
11
|
-
// isShow: boolean;
|
12
|
-
// }
|
13
|
-
|
14
|
-
// function createMessageVerify(props: Props) {
|
15
|
-
// // 创建一个挂载点
|
16
|
-
// const container = document.createElement('div');
|
17
|
-
// document.body.appendChild(container);
|
18
|
-
|
19
|
-
// // 渲染弹窗
|
20
|
-
// const root = createRoot(container);
|
21
|
-
// // 这里 isShow 直接传 true,弹窗立即显示
|
22
|
-
// root.render(<App {...props} isShow={true} />);
|
23
|
-
|
24
|
-
// // 可选:返回关闭方法
|
25
|
-
// return {
|
26
|
-
// destroy: () => {
|
27
|
-
// root.unmount();
|
28
|
-
// document.body.removeChild(container);
|
29
|
-
// }
|
30
|
-
// };
|
31
|
-
// }
|
32
|
-
|
33
|
-
// export { createMessageVerify };
|
34
|
-
// export default createMessageVerify;
|
35
|
-
// src/modal.tsx
|
36
|
-
// src/modal.tsx
|
37
1
|
import Modal from './compoments/modal.js'
|
38
2
|
import ReactDOM from 'react-dom/client'
|
3
|
+
import { useEffect, useState } from'react'
|
39
4
|
|
40
5
|
export type ModalConfig = {
|
41
|
-
|
42
|
-
|
43
|
-
|
6
|
+
data: {
|
7
|
+
mobile: string;
|
8
|
+
verifyCodeKey: string;
|
9
|
+
sendSuccess: boolean;
|
10
|
+
};
|
44
11
|
onClose?: () => void
|
45
12
|
}
|
46
13
|
|
47
14
|
let modalRoot: ReactDOM.Root | null = null
|
48
15
|
|
49
|
-
const
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
{
|
55
|
-
|
56
|
-
)
|
16
|
+
const ModalDom = ({ config }: { config: ModalConfig }) => {
|
17
|
+
const [visible, setVisible] = useState(true);
|
18
|
+
const { data } = config || {};
|
19
|
+
const { mobile } = data || {};
|
20
|
+
|
21
|
+
useEffect(() => {
|
22
|
+
console.log('mobile', mobile);
|
23
|
+
}, [])
|
24
|
+
|
25
|
+
return (
|
26
|
+
<Modal
|
27
|
+
visible={visible}
|
28
|
+
onClose={() => {
|
29
|
+
setVisible(false);
|
30
|
+
config.onClose?.();
|
31
|
+
}}
|
32
|
+
>
|
33
|
+
<div>已发送短信至您的手机:{mobile}</div>
|
34
|
+
</Modal>
|
35
|
+
);
|
36
|
+
};
|
37
|
+
// ... existing code ...
|
57
38
|
|
58
|
-
export const
|
39
|
+
export const createMessageVerifyModal = (config: ModalConfig) => {
|
59
40
|
const container = document.createElement('div')
|
60
41
|
container.id = 'antd-modal-container'
|
61
42
|
document.body.appendChild(container)
|
62
43
|
|
63
44
|
modalRoot = ReactDOM.createRoot(container)
|
64
45
|
modalRoot.render(
|
65
|
-
<
|
46
|
+
<ModalDom
|
66
47
|
config={{
|
67
48
|
...config,
|
68
49
|
onClose: () => {
|
package/src/main.tsx
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
import { createRoot } from 'react-dom/client';
|
2
|
-
import {
|
2
|
+
import { createMessageVerifyModal } from './index.js'; // 或 './index'
|
3
|
+
|
4
|
+
const data = {
|
5
|
+
mobile: '185****7760',
|
6
|
+
verifyCodeKey: 'e381c5f9-c7f4-4bf1-a948-744334fb0203',
|
7
|
+
sendSuccess: true
|
8
|
+
}
|
3
9
|
|
4
10
|
createRoot(document.getElementById('root')!).render(
|
5
|
-
<button onClick={() =>
|
11
|
+
<button onClick={() => createMessageVerifyModal({ data })}>
|
6
12
|
Show Modal
|
7
13
|
</button>);
|