Merge pull request #375 from tangly1024/bugfix/floa-menu

Bugfix/float menu
This commit is contained in:
tangly1024
2022-09-22 22:03:15 +08:00
committed by GitHub
2 changed files with 10 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ import { useGlobal } from '@/lib/global'
import * as ThemeMap from '@/themes'
import React from 'react'
import { idToUuid } from 'notion-utils'
import { useRouter } from 'next/router'
import Router from 'next/router'
import { isBrowser } from '@/lib/utils'
/**
@@ -17,10 +17,10 @@ const Slug = props => {
const { theme, changeLoadingState } = useGlobal()
const ThemeComponents = ThemeMap[theme]
const { post, siteInfo } = props
const router = Router.useRouter()
if (!post) {
changeLoadingState(true)
const router = useRouter()
setTimeout(() => {
if (isBrowser()) {
const article = document.getElementById('container')
@@ -48,9 +48,9 @@ const Slug = props => {
}, [post])
/**
* 验证文章密码
* @param {*} result
*/
* 验证文章密码
* @param {*} result
*/
const validPassword = result => {
if (result) {
setLock(false)
@@ -69,6 +69,10 @@ const Slug = props => {
tags: post?.tags
}
Router.events.on('routeChangeComplete', () => {
window.scrollTo({ top: 0, behavior: 'smooth' })
})
return (
<ThemeComponents.LayoutSlug {...props} showArticleInfo={true} meta={meta} />
)

View File

@@ -26,7 +26,7 @@ const MenuList = (props) => {
if (link && link.show) {
const selected = (router.pathname === link.to) || (router.asPath === link.to)
return <Link key={`${link.to}`} title={link.to} href={link.to} >
<a target='_blank' className={'py-1.5 px-5 text-base justify-between hover:bg-indigo-400 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center ' +
<a className={'py-1.5 px-5 text-base justify-between hover:bg-indigo-400 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center ' +
(selected ? 'bg-gray-200 text-black' : ' ')} >
<div className='my-auto items-center justify-center flex '>
<i className={`${link.icon} w-4 text-center`} />