fix: 修复 QRLogin SDK 二维码不显示的问题
1. 使用 getElementById 获取容器,避免清空容器本身 2. 确保 DOM 渲染完成后再调用 SDK Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user