bug:密码一闪而过

This commit is contained in:
tangly1024
2022-04-13 09:46:08 +08:00
parent 505d1aa405
commit c9e9a55ca7
2 changed files with 5 additions and 4 deletions

View File

@@ -19,9 +19,9 @@ const Slug = props => {
}
// 文章锁🔐
const [lock, setLock] = useState(true)
const [lock, setLock] = useState(post.password && post.password !== '')
useEffect(() => {
if (post && post.password && post.password !== '') {
if (post.password && post.password !== '') {
setLock(true)
} else {
setLock(false)

View File

@@ -35,9 +35,10 @@ const Slug = props => {
}
// 文章锁🔐
const [lock, setLock] = useState(true)
const [lock, setLock] = useState(post.password && post.password !== '')
console.log('lock 默认值', lock)
useEffect(() => {
if (post && post.password && post.password !== '') {
if (post.password && post.password !== '') {
setLock(true)
} else {
setLock(false)