Compare commits
2 Commits
8ba3652072
...
88099b6819
| Author | SHA1 | Date | |
|---|---|---|---|
|
88099b6819
|
|||
|
732774551d
|
@ -2,8 +2,15 @@
|
||||
import { onMount } from 'svelte'
|
||||
import { mainpageClick, mainpageGetClick } from '../lib/apis/legacy/mainpage'
|
||||
|
||||
let clicks = 0
|
||||
let clicksPending = 0
|
||||
interface Props {
|
||||
initialClicks?: number
|
||||
}
|
||||
|
||||
let { initialClicks = 0 }: Props = $props()
|
||||
|
||||
// svelte-ignore state_referenced_locally
|
||||
let clicks = $state(initialClicks)
|
||||
let clicksPending = $state(0)
|
||||
|
||||
onMount(() => {
|
||||
// 先 fetch 一次
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import axios from 'axios'
|
||||
|
||||
export const legacyClient = axios.create({
|
||||
baseURL: '/api/legacy',
|
||||
baseURL: import.meta.env.SSR
|
||||
? 'https://legacy.passthem.top/api'
|
||||
: '/api/legacy',
|
||||
timeout: 6000,
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
|
||||
9
src/pages/contact.astro
Normal file
9
src/pages/contact.astro
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
import BoringLayout from '../layout/BoringLayout.astro'
|
||||
---
|
||||
|
||||
<BoringLayout title="联络我">
|
||||
<h1>联络我</h1>
|
||||
<p>邮箱:<a href="mailto:passthem183@gmail.com">passthem183@gmail.com</a></p>
|
||||
<p>点击 <a href="/">这里</a> 返回主页</p>
|
||||
</BoringLayout>
|
||||
@ -1,11 +1,25 @@
|
||||
---
|
||||
import BoringLayout from '../layout/BoringLayout.astro'
|
||||
import MainpageButton from '../components/MainpageButton.svelte'
|
||||
|
||||
import { mainpageGetClick } from '../lib/apis/legacy/mainpage'
|
||||
|
||||
// 无用按钮的数字预注入
|
||||
|
||||
let initialClicks = 0
|
||||
|
||||
try {
|
||||
const resp = await mainpageGetClick()
|
||||
initialClicks = resp.data
|
||||
} catch (e) {
|
||||
console.error('在获取点击数量时失败了', e)
|
||||
}
|
||||
---
|
||||
|
||||
<BoringLayout>
|
||||
<h1>博客系统翻新中...</h1>
|
||||
<p>点击 <a href="https://legacy.passthem.top">这里</a> 查看旧版博客</p>
|
||||
<p>或者了解更多 <a href="/about">关于这里</a></p>
|
||||
<p><MainpageButton client:only /></p>
|
||||
<p>也欢迎你来 <a href="/contact">联络我</a></p>
|
||||
<p><MainpageButton initialClicks={initialClicks} client:load /></p>
|
||||
</BoringLayout>
|
||||
|
||||
Reference in New Issue
Block a user