diff --git a/themes/gitbook/components/ArticleLock.js b/themes/gitbook/components/ArticleLock.js index dd63992c..03d11d1a 100644 --- a/themes/gitbook/components/ArticleLock.js +++ b/themes/gitbook/components/ArticleLock.js @@ -1,4 +1,5 @@ import { useGlobal } from '@/lib/global' +import { useRouter } from 'next/router' import { useEffect, useRef } from 'react' /** @@ -11,24 +12,40 @@ import { useEffect, useRef } from 'react' export const ArticleLock = props => { const { validPassword } = props const { locale } = useGlobal() - console.log('locale', locale) + const router = useRouter() + const passwordInputRef = useRef(null) + /** + * 输入提交密码 + */ const submitPassword = () => { const p = document.getElementById('password') + + // 验证失败提示 if (!validPassword(p?.value)) { const tips = document.getElementById('tips') if (tips) { tips.innerHTML = '' tips.innerHTML = `