diff --git a/packages/icon-v2/src/demo/demo.tsx b/packages/icon-v2/src/demo/demo.tsx index 46f52e0..3630472 100644 --- a/packages/icon-v2/src/demo/demo.tsx +++ b/packages/icon-v2/src/demo/demo.tsx @@ -15,18 +15,38 @@ const demo = () => { } }; - async function copyTextToClipboard(textToCopy: string, successMessage?: string): Promise { + const copyTextToClipboard = async (textToCopy: string, successMessage?: string): Promise => { + if (navigator.clipboard && navigator.clipboard.writeText) { try { // 使用现代API尝试复制 await navigator.clipboard.writeText(textToCopy); message.success(successMessage) } catch (error) { - // 如果浏览器不支持或者用户拒绝了权限,可以考虑降级处理 - // 但在这个示例中,我们直接捕获异常并记录日志 - message.error('复制失败') + console.error('Failed to copy: ', error); + }} else { + fallbackCopyTextToClipboard(textToCopy,successMessage); } } + const fallbackCopyTextToClipboard = (textToCopy: string, successMessage?: string) => { + // 创建隐藏的textarea来模拟复制操作 + const input = document.createElement('input'); + input.setAttribute('value', textToCopy); + document.body.appendChild(input); + input.select(); + try { + if (document.execCommand('copy')) { + message.success(successMessage) + } else { + console.error('传统方式复制失败'); + } + } catch (error) { + console.error('传统方式复制出错:', error); + } finally { + document.body.removeChild(input); + } + } + return (
diff --git a/packages/icon-v2/src/icons/Map.tsx b/packages/icon-v2/src/icons/Map.tsx new file mode 100644 index 0000000..36930a9 --- /dev/null +++ b/packages/icon-v2/src/icons/Map.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { CustomSVGProps } from '../type'; + +const Map = (props: CustomSVGProps) => ( + + + +); + +export default Map; diff --git a/packages/icon-v2/src/icons/Screenl.tsx b/packages/icon-v2/src/icons/Screenl.tsx new file mode 100644 index 0000000..9db7727 --- /dev/null +++ b/packages/icon-v2/src/icons/Screenl.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { CustomSVGProps } from '../type'; + +const Screenl = (props: CustomSVGProps) => ( + + + +); + +export default Screenl; diff --git a/packages/icon-v2/src/icons/Screenm.tsx b/packages/icon-v2/src/icons/Screenm.tsx new file mode 100644 index 0000000..8165650 --- /dev/null +++ b/packages/icon-v2/src/icons/Screenm.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { CustomSVGProps } from '../type'; + +const Screenm = (props: CustomSVGProps) => ( + + + +); + +export default Screenm; diff --git a/packages/icon-v2/src/icons/Screens.tsx b/packages/icon-v2/src/icons/Screens.tsx new file mode 100644 index 0000000..e5ee0b5 --- /dev/null +++ b/packages/icon-v2/src/icons/Screens.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { CustomSVGProps } from '../type'; + +const Screens = (props: CustomSVGProps) => ( + + + +); + +export default Screens; diff --git a/packages/icon-v2/src/index.ts b/packages/icon-v2/src/index.ts index 0037103..2a73db8 100644 --- a/packages/icon-v2/src/index.ts +++ b/packages/icon-v2/src/index.ts @@ -112,4 +112,7 @@ export { default as View } from './icons/View'; export { default as Warningfilled } from './icons/Warningfilled'; export { default as Zoomin } from './icons/Zoomin'; export { default as Zoomoff } from './icons/Zoomoff'; - +export { default as Map } from './icons/Map'; +export { default as Screenl } from './icons/Screenl'; +export { default as Screenm } from './icons/Screenm'; +export { default as Screens } from './icons/Screens';