clear iframe double
This commit is contained in:
@@ -168,19 +168,28 @@
|
||||
console.error('Error fetching session:', error);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function OpenIframe(){
|
||||
// 在成功获取 session 后创建并插入 iframe
|
||||
const iframe = document.createElement('iframe');
|
||||
const div=document.getElementById('vscodeWeb')
|
||||
|
||||
const iframes = document.getElementsByTagName('iframe');
|
||||
|
||||
// 删除除了第一个 iframe 外的其他所有 iframe
|
||||
for (let i = 1; i < iframes.length; i++) {
|
||||
iframes[i].remove();
|
||||
}
|
||||
|
||||
|
||||
|
||||
const sessionInfo = data
|
||||
iframe.src = '{{vscode_web_url}}/?workspace={{workspace_path}}&folder={{workspace_path}}';
|
||||
iframe.style.width = '100%';
|
||||
iframe.style.height = '99%';
|
||||
|
||||
// 将 iframe 插入到指定的 div 中
|
||||
document.getElementById('vscodeWeb').innerHTML = '';
|
||||
document.getElementById('vscodeWeb').appendChild(iframe);
|
||||
div.appendChild(iframe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user