fix(plugins): 安装后不再用 window.confirm(原生弹窗会卡住 WebView),改为页内「立即重启」
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 43s

This commit is contained in:
qiqi committed 2026-11-17 12:13:34 +08:00
1 parent 6d2ccce1ba
commit 6426b9db37
1 file changed
+6 -1
+6 -1
View File
@@ -23,6 +23,7 @@
const [installed, setInstalled] = React.useState({})
const [msg, setMsg] = React.useState('')
const [busy, setBusy] = React.useState('')
const [restart, setRestart] = React.useState(false)
const D = (typeof window !== 'undefined') ? window.IWBDesktop : null
const refresh = React.useCallback(async () => {
if (!D || !D.market) { setRows([]); return }
@@ -43,7 +44,7 @@
if (!r || !r.ok) { setMsg((r && r.error) || '操作失败'); return }
setMsg(kind === 'install' ? '已安装,重启应用后生效' : '已卸载,重启应用后生效')
await refresh()
if (window.confirm('需要重启应用才能生效,现在重启?')) window.location.reload()
setRestart(true)
} finally { setBusy('') }
}
if (rows === null) return el('div', { className: 'iwb-hint' }, '插件市场加载中…')
@@ -182,6 +183,10 @@
),
el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act('install', m.id) }, busy === m.id ? '处理中…' : '安装'),
)),
restart ? el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-hint', style: { flex: '1 1 auto' } }, '需要重启应用才能生效'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => window.location.reload() }, '立即重启'),
) : null,
msg ? el('div', { className: 'iwb-hint' }, msg) : null,
)
}