From f4c8a29ba1e0c937194a38c9e77bb514962518f2 Mon Sep 17 00:00:00 2001 From: Davdeyang <1320501826@qq.com> Date: Thu, 23 Mar 2023 00:46:51 +0800 Subject: [PATCH 01/10] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0dromDown=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/_test.tsx | 24 ++++++- src/components/dropDown/dropDown.module.css | 11 ++++ src/components/dropDown/dropDown.module.less | 13 ++++ src/components/dropDown/index.tsx | 68 ++++++++++++++++++++ 4 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 src/components/dropDown/dropDown.module.css create mode 100644 src/components/dropDown/dropDown.module.less create mode 100644 src/components/dropDown/index.tsx diff --git a/src/_test.tsx b/src/_test.tsx index 4e3a04d..046615c 100644 --- a/src/_test.tsx +++ b/src/_test.tsx @@ -6,10 +6,13 @@ import Upload from './components/upload/upload'; import Tab from './components/tab/tab'; import * as GOJI from 'goji_ui' +import DropDown from './components/dropDown'; function App() { const [visible, setVisible] = useState(false) const [ev, setEv] = useState(false) + const [modalVisible,setModalVisible]= useState(false); + return
+ =X3Qr~BrP>9;Ua@$Gn{=U0|Q2hoH!QK zdPyd^dH05_j`5o8QojWJANX5SJ`R2rq&rL4(L3Z!c&(ozCDFWWYJ7DccZDny${xJo z!eWt@cJW!}Wps`oVdS_2{U{fqJ5};+9T)WZrj#DP;hd@`4v^YTW)vfm$2w4g<@8*Z zlF)@86DebVJm!L_m1YytcKax<4mnk<$h_n)y1J5dIJ{meGGX3WpYbq$Z&7g|$WFPb z^w{_6kZKH@xQ9NhpK3$6yRcbgX->{c(cKp5sMv=U)%Z!r!?JEpzV?U-JCexzSY4L-&mUC$Na)=5rn{4eR z!l+l4w8j!Fu5{b#trMp7P4C17>WL~E+pY&T&c|Q3hK0imblF*Tb1>fs>1Sel=8DJn zuadIax;_=0rnBY9Dt7uO$cqPJnWmM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=Xwti)eDib`JC)IBZXG@ApIOm!YcCnw;h#2YZL3@eN z3pZ9ub=k&@F}!DjrK~p_B{)c}xineg+!#G32{6^GawRf(+tDYma4s%~5-Ig`-l1IF z{cAeuyc~kdS<*IdidVj 4@FHaF{>7I5bLh^A#a_)bhb5Z3B7Gfs*6ZYv-F_^ZXEq {bHm2;hyA7qz+XXTSVM-v80%|KK+*)#(2N DHC@J> literal 0 HcmV?d00001 From 43b8d35157b7a611c2e8f16151dff6074e65cc04 Mon Sep 17 00:00:00 2001 From: Davdeyang <1320501826@qq.com> Date: Thu, 23 Mar 2023 23:29:26 +0800 Subject: [PATCH 04/10] =?UTF-8?q?feat:dropDown=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/_test.tsx | 3 +- src/components/dropDown/dropDown.module.css | 186 ++++++++++++++++- src/components/dropDown/dropDown.module.less | 206 ++++++++++++++++++- src/components/dropDown/index.tsx | 145 +++++++------ src/components/dropDown/model.tsx | 43 ++++ 5 files changed, 505 insertions(+), 78 deletions(-) create mode 100644 src/components/dropDown/model.tsx diff --git a/src/_test.tsx b/src/_test.tsx index 0db12f2..1ee8ec3 100644 --- a/src/_test.tsx +++ b/src/_test.tsx @@ -113,7 +113,8 @@ function App() { onChangeVisible={() => { setModalVisible(!modalVisible); }} - // width={100} + position="topRight" + width={150} disable={false} style={{ width: "100px", diff --git a/src/components/dropDown/dropDown.module.css b/src/components/dropDown/dropDown.module.css index a6316a4..79bf71a 100644 --- a/src/components/dropDown/dropDown.module.css +++ b/src/components/dropDown/dropDown.module.css @@ -1,15 +1,112 @@ .dropDown { + margin-top: 100px; position: relative; } .dropDown .dropDownButton { cursor: pointer; + display: flex; + justify-content: space-between; + align-items: center; +} +.dropDown .modelLeft { + position: absolute; + cursor: pointer; + padding: 5px; + display: inline-block; + height: auto; + border-radius: 5px; + box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); +} +.dropDown .modelLeft .modelList { + margin: 0; + padding: 0; +} +.dropDown .modelLeft .modelList .modalListItem { + list-style: none; + padding: 5px; +} +.dropDown .modelLeft .modelList .modalListItem a { + text-decoration: none; + color: #414141; +} +.dropDown .modelLeft .modelList .modalListItem:hover { + transition: all 0.2s; + background-color: aliceblue; +} +.dropDown .modelLeft::after { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #a07676 transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 9px; + z-index: 99; +} +.dropDown .modelLeft::before { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #884b4b transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 9px; + z-index: 99; +} +.dropDown .modelCenter { + cursor: pointer; + padding: 5px; + display: inline-block; + height: auto; + border-radius: 5px; + box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); +} +.dropDown .modelCenter .modelList { + margin: 0; + padding: 0; +} +.dropDown .modelCenter .modelList .modalListItem { + list-style: none; + padding: 5px; +} +.dropDown .modelCenter .modelList .modalListItem a { + text-decoration: none; + color: #414141; +} +.dropDown .modelCenter .modelList .modalListItem:hover { + transition: all 0.2s; + background-color: aliceblue; +} +.dropDown .modelCenter::before { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #ffffff transparent; + border-style: dashed dashed solid dashed; position: absolute; - top: 0; - left: 0; + top: -11px; + right: 45%; + z-index: 99; } -.dropDown .model { +.dropDown .modelCenter::after { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #ffffff transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 45%; + z-index: 99; +} +.dropDown .modelTopRight { position: absolute; - top: 25px; cursor: pointer; padding: 5px; display: inline-block; @@ -17,19 +114,92 @@ border-radius: 5px; box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); } -.dropDown .model .modelList { +.dropDown .modelTopRight .modelList { margin: 0; padding: 0; } -.dropDown .model .modelList .modalListItem { +.dropDown .modelTopRight .modelList .modalListItem { list-style: none; padding: 5px; } -.dropDown .model .modelList .modalListItem a { +.dropDown .modelTopRight .modelList .modalListItem a { text-decoration: none; color: #414141; } -.dropDown .model .modelList .modalListItem:hover { +.dropDown .modelTopRight .modelList .modalListItem:hover { transition: all 0.2s; background-color: aliceblue; } +.dropDown .modelTopRight::before { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 9px; + z-index: 99; +} +.dropDown .modelTopRight::after { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 9px; + z-index: 99; +} +.dropDown .modelTopCenter { + position: absolute; + cursor: pointer; + padding: 5px; + display: inline-block; + height: auto; + border-radius: 5px; + box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); +} +.dropDown .modelTopCenter .modelList { + margin: 0; + padding: 0; +} +.dropDown .modelTopCenter .modelList .modalListItem { + list-style: none; + padding: 5px; +} +.dropDown .modelTopCenter .modelList .modalListItem a { + text-decoration: none; + color: #414141; +} +.dropDown .modelTopCenter .modelList .modalListItem:hover { + transition: all 0.2s; + background-color: aliceblue; +} +.dropDown .modelTopCenter::before { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 45%; + z-index: 99; +} +.dropDown .modelTopCenter::after { + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 45%; + z-index: 99; +} diff --git a/src/components/dropDown/dropDown.module.less b/src/components/dropDown/dropDown.module.less index 9d2c224..c0c9ce7 100644 --- a/src/components/dropDown/dropDown.module.less +++ b/src/components/dropDown/dropDown.module.less @@ -1,15 +1,75 @@ .dropDown { + margin-top: 100px; position: relative; + // overflow: hidden; .dropDownButton { cursor: pointer; + // position: absolute; + // top: 0; + // left: 0; + display: flex; + justify-content: space-between; + align-items: center; + } + + .modelLeft{ position: absolute; - top: 0; - left: 0; + cursor: pointer; + height: auto; + padding: 5px; + display: inline-block; + height: auto; + border-radius: 5px; + box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); + + .modelList{ + margin: 0; + padding: 0; + .modalListItem { + list-style: none; + padding: 5px; + a{ + text-decoration: none; + color: rgb(65, 65, 65); + } + } + + .modalListItem:hover{ + transition: all .2s; + background-color: aliceblue; + } + } } - .model { + .modelLeft::after{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #a07676 transparent; + border-style: dashed dashed solid dashed; position: absolute; - top: 25px; + top: -11px; + right: 9px; + z-index: 99; + } + + .modelLeft::before{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #884b4b transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 9px; + z-index: 99; + } + + .modelCenter{ + // position: absolute; cursor: pointer; height: auto; padding: 5px; @@ -36,6 +96,144 @@ background-color: aliceblue; } } + } + + .modelCenter::before{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #ffffff transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 45%; + z-index: 99; + } + .modelCenter::after{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: transparent transparent #ffffff transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 45%; + z-index: 99; + } + + + .modelTopRight{ + position: absolute; + cursor: pointer; + height: auto; + padding: 5px; + display: inline-block; + height: auto; + border-radius: 5px; + box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); + + .modelList{ + margin: 0; + padding: 0; + .modalListItem { + list-style: none; + padding: 5px; + a{ + text-decoration: none; + color: rgb(65, 65, 65); + } + } + + .modalListItem:hover{ + transition: all .2s; + background-color: aliceblue; + } + } + } + + .modelTopRight::before{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 9px; + z-index: 99; + } + + .modelTopRight::after{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 9px; + z-index: 99; + } + + .modelTopCenter{ + position: absolute; + cursor: pointer; + height: auto; + padding: 5px; + display: inline-block; + height: auto; + border-radius: 5px; + box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05); + + .modelList{ + margin: 0; + padding: 0; + .modalListItem { + list-style: none; + padding: 5px; + a{ + text-decoration: none; + color: rgb(65, 65, 65); + } + } + + .modalListItem:hover{ + transition: all .2s; + background-color: aliceblue; + } + } + } + + .modelTopCenter::before{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 45%; + z-index: 99; + } + + .modelTopCenter::after{ + width: 0; + height: 0; + content: ""; + border-width: 6px; + border-color: #ffffff transparent transparent transparent; + border-style: dashed dashed solid dashed; + position: absolute; + top: -11px; + right: 45%; + z-index: 99; } } diff --git a/src/components/dropDown/index.tsx b/src/components/dropDown/index.tsx index bbb076c..2de8bca 100644 --- a/src/components/dropDown/index.tsx +++ b/src/components/dropDown/index.tsx @@ -1,9 +1,11 @@ -import React, { ReactNode, useEffect, useMemo, useState } from "react"; +import React, { ReactNode, useState } from "react"; import { createPortal } from "react-dom"; import styles from "./dropDown.module.less"; +import Model from "./model"; type trigger = "click" | "hover"; -type position = "left" | "right" | "top" | "bottom"; +type position = "bottomRight" | "bottom" | "top" | "topRight"; + interface IDropDown { // trigger?: ("click" | "hover")[]; trigger: trigger; @@ -33,76 +35,89 @@ const DropDown: React.FC = ({ const [show, setShow] = useState(visible); const dropDown = document.getElementById("dropDown") as HTMLElement; - const fixedPositon = () => { - switch (position) { - case "left": - return { - bottom: 0, - left: 0, - }; - case "right": - return { - right: 0, - top: 0, - }; - case "top": - return { - bottom: 0, - left: 0, - }; - case "bottom": - return { - bottom: 0, - left: 0, - }; - default: - break; - } + const fixedPosition = { + bottomRight: { + top: "30px", + }, + bottom: { + top: "30px", + }, + top: { + bottom: "30px", + }, + topRight: { + bottom: "30px", + }, + }; + + const modelClassName = { + bottom: "modelCenter", + bottomLeft: "modelLeft", + top: "modelTopCenter", + topRight: "modelTopRight", }; return ( - - {trigger === "click" ? ( - - ) : ( - + {(show === true || visible === true) && + createPortal( ++ )} + > ); }; diff --git a/src/components/dropDown/model.tsx b/src/components/dropDown/model.tsx new file mode 100644 index 0000000..f3891f7 --- /dev/null +++ b/src/components/dropDown/model.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import { createPortal } from "react-dom"; +import styles from "./dropDown.less"; + +interface IModel { + modelContent: object[]; + dropDown?: HTMLElement; + width?: number; + fixedPosition: any; +} + +const Model: React.FC+, + dropDown + )} ++ {modelContent?.map((item) => { + return ( +
+- + {item?.label} +
+ ); + })} += ({ + modelContent, + dropDown, + width, + fixedPosition, +}) => { + console.log('====',modelContent, dropDown, width, fixedPosition); + + return ( + <> + {createPortal( + +, + dropDown + )} + > + ); +}; + +export default Model; From 0816b7240eaf74f357912d7e261a232f2aaeb6c0 Mon Sep 17 00:00:00 2001 From: Davdeyang <1320501826@qq.com> Date: Fri, 24 Mar 2023 10:34:30 +0800 Subject: [PATCH 05/10] =?UTF-8?q?feat:drop=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/_test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_test.tsx b/src/_test.tsx index 1ee8ec3..ecaa4d6 100644 --- a/src/_test.tsx +++ b/src/_test.tsx @@ -108,7 +108,7 @@ function App() {+ {modelContent?.map((item) => { + return ( +
+- + {item?.label} +
+ ); + })} +{ setModalVisible(!modalVisible); From 6646893a394263d74e6b52b4a6500859b3e1c34c Mon Sep 17 00:00:00 2001 From: Davdeyang <1320501826@qq.com> Date: Wed, 29 Mar 2023 15:00:31 +0800 Subject: [PATCH 06/10] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0button=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=20=E4=BB=A5=E5=8F=8A=E4=BF=AE=E6=94=B9dropdown?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 11 + package.json | 3 +- rollup.config.mjs | 4 +- src/_test.css | 11 + src/_test.less | 5 + src/_test.tsx | 144 +++++++---- src/common/style/index.css | 8 + src/common/style/index.less | 9 + src/components/button/button.tsx | 79 ++++++ src/components/button/index.css | 61 +++++ src/components/button/index.less | 72 ++++++ src/components/dropDown/dropDown.css | 156 ++++++++++++ src/components/dropDown/dropDown.less | 170 +++++++++++++ src/components/dropDown/dropDown.module.css | 205 ---------------- src/components/dropDown/dropDown.module.less | 239 ------------------- src/components/dropDown/index.tsx | 151 ++++++------ src/components/dropDown/model.tsx | 25 +- 17 files changed, 778 insertions(+), 575 deletions(-) create mode 100644 src/_test.css create mode 100644 src/_test.less create mode 100644 src/common/style/index.css create mode 100644 src/common/style/index.less create mode 100644 src/components/button/button.tsx create mode 100644 src/components/button/index.css create mode 100644 src/components/button/index.less create mode 100644 src/components/dropDown/dropDown.css create mode 100644 src/components/dropDown/dropDown.less delete mode 100644 src/components/dropDown/dropDown.module.css delete mode 100644 src/components/dropDown/dropDown.module.less diff --git a/package-lock.json b/package-lock.json index fe19286..5c3c76b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@types/uuid": "^9.0.1", + "classnames": "^2.3.2", "framer-motion": "^8.5.5", "uuid": "^9.0.0" }, @@ -4883,6 +4884,11 @@ "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, + "node_modules/classnames": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", + "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" + }, "node_modules/clean-css": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.2.tgz", @@ -17996,6 +18002,11 @@ "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, + "classnames": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", + "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" + }, "clean-css": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.2.tgz", diff --git a/package.json b/package.json index 6f4b3ba..199c9e5 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,8 @@ }, "dependencies": { "@types/uuid": "^9.0.1", + "classnames": "^2.3.2", "framer-motion": "^8.5.5", "uuid": "^9.0.0" } -} \ No newline at end of file +} diff --git a/rollup.config.mjs b/rollup.config.mjs index b8ca7dc..66ef197 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -68,6 +68,6 @@ export default [ input: "dist/esm/types/index.d.ts", output: [{ file: "dist/index.d.ts", format: "esm" }], plugins: [dts.default()], - external: [/\.less$/], // telling rollup anything that is .css aren't part of type exports + external: [/\.less$/], // telling rollup anything that is .css aren't part of type exports }, -] \ No newline at end of file +] diff --git a/src/_test.css b/src/_test.css new file mode 100644 index 0000000..339c262 --- /dev/null +++ b/src/_test.css @@ -0,0 +1,11 @@ +:root { + --background: #ebedff; + --blueDark: #5c6dff; + --fadedGary: #818181; + --white: #ffffff; + --black: #000000; + --white-shadow: 0px 0px 13px 5px rgba(173, 182, 255, 0.25); +} +a { + text-decoration: none; +} diff --git a/src/_test.less b/src/_test.less new file mode 100644 index 0000000..718ed92 --- /dev/null +++ b/src/_test.less @@ -0,0 +1,5 @@ +@import '../src/common/style/index.less'; + +a{ + text-decoration: none; +} diff --git a/src/_test.tsx b/src/_test.tsx index ec06faf..d28eb02 100644 --- a/src/_test.tsx +++ b/src/_test.tsx @@ -5,6 +5,8 @@ import Upload from "./components/upload/upload"; import Tab from "./components/tab/tab"; import * as GOJI from "goji_ui"; import DropDown from "./components/dropDown"; +import Button from "./components/button/button"; +import "./_test.less"; function App() { const [visible, setVisible] = useState(false); @@ -72,18 +74,18 @@ function App() { ]} /> - { - setVisible(false) - }} - visible={visible} - > - +- how to set default value for typescript interface field - --{ + setVisible(false); + }} + visible={visible} + > + + how to set default value for typescript interface field + ++- { setModalVisible(!modalVisible); }} - position="topRight" + position="topRight" width={150} - disable={false} - style={{ - width: "100px", - height: "100px", - backgroundColor: "green", + modelContent={[ + { + id: "1", + label: "first Item", + }, + { + id: "2", + label: "second Item", + }, + ]} + // className={"modless"} + > + SHOW MODEL + */} + +{ + setModalVisible(!modalVisible); }} + position="bottom" + width={150} modelContent={[ { id: "1", - label: ( - - 1st menu item - - ), + label: "first Item", }, { id: "2", - label: ( - - 2nd menu item - - ), + label: "second Item", }, - ] - } + ]} + icons={[ + , + , + ]} // className={"modless"} > - SHOW MODEL + ++ SHOW MODEL
{ + console.log("primary"); + }} + > + primary + ++ { + alert("Dashed Button"); + }} + > + dashed + +Link +Text +Circle ++ A + ++ 会计师 + +disable