diff --git a/frontend/src/pages/login/QRCodeLogin.tsx b/frontend/src/pages/login/QRCodeLogin.tsx index 164b4e6..4f47e19 100644 --- a/frontend/src/pages/login/QRCodeLogin.tsx +++ b/frontend/src/pages/login/QRCodeLogin.tsx @@ -90,16 +90,20 @@ export default function QRCodeLogin({ visible, onClose }: QRCodeLoginProps) { if (window.QRLogin) { console.log('✅ Using Feishu QR SDK') // 使用飞书官方 QR SDK - if (qrContainerRef.current) { - qrContainerRef.current.innerHTML = '' + // 先清空容器内容(保留容器元素本身) + const container = document.getElementById('feishu-qrcode-container') + if (container) { + container.innerHTML = '' } - - qrObjRef.current = window.QRLogin({ - id: 'feishu-qrcode-container', - goto: authUrl, - width: '200', - height: '200', - }) + // 确保 DOM 已渲染后再调用 SDK + setTimeout(() => { + qrObjRef.current = window.QRLogin({ + id: 'feishu-qrcode-container', + goto: authUrl, + width: '200', + height: '200', + }) + }, 50) setStatus('pending') startPolling(result.data.session_id)