feat(componentCoding): 增加git地址复制功能

master
钟良源 2 months ago
parent 2b6d21ada6
commit 751a631bbd

@ -14,7 +14,7 @@ const ComponentCoding = () => {
const [serverUrl, setServerUrl] = useState(''); // code-server 地址 const [serverUrl, setServerUrl] = useState(''); // code-server 地址
const [optionsList, setOptionsList] = useState([]); // 下拉选择菜单 const [optionsList, setOptionsList] = useState([]); // 下拉选择菜单
const [originList, setOriginList] = useState([]); // 原始数据-组件列表 const [originList, setOriginList] = useState([]); // 原始数据-组件列表
const [currentComponent, setCurrentComponent] = useState({}); // 当前组件信息 const [currentComponent, setCurrentComponent] = useState<any>({}); // 当前组件信息
const [isFullscreen, setIsFullscreen] = useState(false); // 全屏状态 const [isFullscreen, setIsFullscreen] = useState(false); // 全屏状态
const [commitMessage, setCommitMessage] = useState(''); // 提交信息 const [commitMessage, setCommitMessage] = useState(''); // 提交信息
const [commitModal, setCommitModal] = useState(false); // 提交信息弹窗 const [commitModal, setCommitModal] = useState(false); // 提交信息弹窗
@ -101,9 +101,9 @@ const ComponentCoding = () => {
} }
}; };
const openModal = (value) => { const copyGitUrlHandler = () => {
const selectedItem = originList.find(item => item.localProjectPath === value); navigator.clipboard.writeText(currentComponent.repoHtmlUrl);
dispatch(updateComponentCodingPath(selectedItem)); Message.success('复制成功');
}; };
useEffect(() => { useEffect(() => {
@ -216,7 +216,7 @@ const ComponentCoding = () => {
/> />
</span> </span>
<span className={styles['align']}> <span className={styles['align']} onClick={copyGitUrlHandler}>
<img src={'/ideContainer/imgs/git.svg'} style={{ width: 16, height: 16, marginRight: 5 }} /> <img src={'/ideContainer/imgs/git.svg'} style={{ width: 16, height: 16, marginRight: 5 }} />
git git
</span> </span>

Loading…
Cancel
Save