[删除旧分页page.js]保留滚动分页;
修复搜索页不重置bug;
This commit is contained in:
tangly1024
2021-11-04 10:11:03 +08:00
parent 5a2c1581b5
commit 8f9d3c45e7
4 changed files with 8 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { useLocale } from '@/lib/locale'
import Router, { useRouter } from 'next/router'
import { useRouter } from 'next/router'
const SearchInput = ({ currentTag }) => {
const locale = useLocale()
@@ -8,12 +8,12 @@ const SearchInput = ({ currentTag }) => {
const [searchValue, setSearchValue] = useState('')
const handleSearch = () => {
if (searchValue && searchValue !== '') {
Router.push({ pathname: '/page/1', query: { s: searchValue } }).then(r => {
console.log(r)
router.push({ pathname: '/', query: { s: searchValue } }).then(r => {
router.reload()
})
} else {
Router.push({ pathname: '/' }).then(r => {
console.log(r)
router.push({ pathname: '/' }).then(r => {
router.reload()
})
}
}