From 5711d85f0a1189e19ebfc59ddd68b5aad1c32d53 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Thu, 3 Mar 2022 12:36:11 +0800 Subject: [PATCH] =?UTF-8?q?fukasawa=20=E6=90=9C=E7=B4=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/Fukasawa/LayoutSearch.js | 17 ++++++++++++++++- themes/Fukasawa/components/AsideLeft.js | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/themes/Fukasawa/LayoutSearch.js b/themes/Fukasawa/LayoutSearch.js index 8112f850..727e9595 100644 --- a/themes/Fukasawa/LayoutSearch.js +++ b/themes/Fukasawa/LayoutSearch.js @@ -1,8 +1,23 @@ import LayoutBase from './LayoutBase' import BlogListPage from './components/BlogListPage' +import { useRouter } from 'next/router' +import { useEffect } from 'react' export const LayoutSearch = (props) => { - return + const { keyword } = props + const router = useRouter() + const currentSearch = keyword || router?.query?.s + useEffect(() => { + setTimeout(() => { + const container = document.getElementById('container') + if (container && container.innerHTML) { + const re = new RegExp(`${currentSearch}`, 'gim') + container.innerHTML = container.innerHTML.replace(re, `${currentSearch}`) + } + }, + 100) + }) + return } diff --git a/themes/Fukasawa/components/AsideLeft.js b/themes/Fukasawa/components/AsideLeft.js index a596ae27..3f1047d7 100644 --- a/themes/Fukasawa/components/AsideLeft.js +++ b/themes/Fukasawa/components/AsideLeft.js @@ -19,7 +19,7 @@ function AsideLeft (props) {

- +