2026-01-19 23:45:08 +08:00
|
|
|
|
<template>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<div class="api-playground">
|
2026-01-20 17:53:22 +08:00
|
|
|
|
<div class="header">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div class="title">
|
|
|
|
|
|
🧪 API 练手场
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="subtitle">
|
|
|
|
|
|
随便玩,坏了算我的
|
|
|
|
|
|
</div>
|
2026-01-20 17:53:22 +08:00
|
|
|
|
</div>
|
2026-01-20 08:51:04 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<div class="playground-layout">
|
|
|
|
|
|
<div class="left-panel">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div class="panel-title">
|
|
|
|
|
|
发送请求
|
|
|
|
|
|
</div>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="input-group">
|
|
|
|
|
|
<label>Endpoint(网址)</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
v-model="endpoint"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
placeholder="/users/123"
|
|
|
|
|
|
class="input"
|
2026-02-18 17:38:10 +08:00
|
|
|
|
>
|
2026-01-19 23:45:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<div class="input-group">
|
|
|
|
|
|
<label>方法</label>
|
|
|
|
|
|
<div class="method-buttons">
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-for="m in methods"
|
|
|
|
|
|
:key="m"
|
|
|
|
|
|
:class="['method-btn', { active: method === m }]"
|
|
|
|
|
|
@click="method = m"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ m }}
|
|
|
|
|
|
</button>
|
2026-01-20 17:53:22 +08:00
|
|
|
|
</div>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
</div>
|
2026-01-19 23:45:08 +08:00
|
|
|
|
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="method === 'POST'"
|
|
|
|
|
|
class="input-group"
|
|
|
|
|
|
>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<label>Body(JSON)</label>
|
|
|
|
|
|
<textarea
|
|
|
|
|
|
v-model="body"
|
|
|
|
|
|
class="textarea"
|
2026-02-18 17:38:10 +08:00
|
|
|
|
placeholder="{"name": "张三"}"
|
|
|
|
|
|
/>
|
2026-01-19 23:45:08 +08:00
|
|
|
|
</div>
|
2026-01-20 17:53:22 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<div class="input-group">
|
|
|
|
|
|
<label>API Key</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
v-model="apiKey"
|
|
|
|
|
|
type="password"
|
|
|
|
|
|
placeholder="sk-..."
|
|
|
|
|
|
class="input"
|
2026-02-18 17:38:10 +08:00
|
|
|
|
>
|
2026-01-19 23:45:08 +08:00
|
|
|
|
</div>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<button
|
|
|
|
|
|
class="send-btn"
|
|
|
|
|
|
:disabled="loading"
|
|
|
|
|
|
@click="sendRequest"
|
|
|
|
|
|
>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
{{ loading ? '发送中...' : '🚀 发送请求' }}
|
|
|
|
|
|
</button>
|
2026-01-19 23:45:08 +08:00
|
|
|
|
</div>
|
2026-01-20 08:51:04 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<div class="right-panel">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div class="panel-title">
|
|
|
|
|
|
响应结果
|
|
|
|
|
|
</div>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="!response"
|
|
|
|
|
|
class="empty-state"
|
|
|
|
|
|
>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<span class="empty-icon">📭</span>
|
|
|
|
|
|
<p>点击发送按钮,看看会发生什么</p>
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<p class="hint">
|
|
|
|
|
|
可以试试输入错误的地址或 Key
|
|
|
|
|
|
</p>
|
2026-01-20 17:53:22 +08:00
|
|
|
|
</div>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-else
|
|
|
|
|
|
class="response-content"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="status-bar"
|
|
|
|
|
|
:class="getStatusClass(response.status)"
|
|
|
|
|
|
>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<span class="status-code">{{ response.status }}</span>
|
|
|
|
|
|
<span class="status-text">{{ response.statusText }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="response-body">
|
|
|
|
|
|
<pre>{{ JSON.stringify(response.data, null, 2) }}</pre>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="response.explanation"
|
|
|
|
|
|
class="explanation"
|
|
|
|
|
|
>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
💡 {{ response.explanation }}
|
|
|
|
|
|
</div>
|
2026-01-20 17:53:22 +08:00
|
|
|
|
</div>
|
2026-01-20 08:51:04 +08:00
|
|
|
|
</div>
|
2026-01-19 23:45:08 +08:00
|
|
|
|
</div>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="tips">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<div class="tip-title">
|
|
|
|
|
|
可以试试这些玩法:
|
|
|
|
|
|
</div>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
<div class="tip-list">
|
2026-02-18 17:38:10 +08:00
|
|
|
|
<button @click="tryEndpoint('/users')">
|
|
|
|
|
|
✅ GET /users
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button @click="tryEndpoint('/users/123')">
|
|
|
|
|
|
✅ GET /users/123
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button @click="tryEndpoint('/posts')">
|
|
|
|
|
|
✅ GET /posts
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button @click="tryError401">
|
|
|
|
|
|
❌ 401 没带 Key
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button @click="tryError404">
|
|
|
|
|
|
❌ 404 地址错了
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button @click="tryError429">
|
|
|
|
|
|
❌ 429 点太快了
|
|
|
|
|
|
</button>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-01-19 23:45:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-01-20 08:51:04 +08:00
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
const endpoint = ref('/users')
|
2026-01-20 17:53:22 +08:00
|
|
|
|
const method = ref('GET')
|
2026-02-01 23:42:12 +08:00
|
|
|
|
const methods = ['GET', 'POST']
|
|
|
|
|
|
const body = ref('{\n "name": "张三",\n "age": 25\n}')
|
|
|
|
|
|
const apiKey = ref('')
|
2026-01-20 17:53:22 +08:00
|
|
|
|
const loading = ref(false)
|
2026-02-01 23:42:12 +08:00
|
|
|
|
const response = ref(null)
|
|
|
|
|
|
|
|
|
|
|
|
function tryEndpoint(path) {
|
|
|
|
|
|
endpoint.value = path
|
|
|
|
|
|
method.value = 'GET'
|
|
|
|
|
|
apiKey.value = 'sk-test123'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function tryError401() {
|
|
|
|
|
|
endpoint.value = '/users'
|
|
|
|
|
|
method.value = 'GET'
|
|
|
|
|
|
apiKey.value = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function tryError404() {
|
|
|
|
|
|
endpoint.value = '/unknown-path'
|
|
|
|
|
|
method.value = 'GET'
|
|
|
|
|
|
apiKey.value = 'sk-test123'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function tryError429() {
|
|
|
|
|
|
endpoint.value = '/users'
|
|
|
|
|
|
method.value = 'GET'
|
|
|
|
|
|
apiKey.value = 'sk-test123'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getStatusClass(status) {
|
|
|
|
|
|
if (status >= 200 && status < 300) return 'success'
|
|
|
|
|
|
if (status >= 400 && status < 500) return 'client-error'
|
|
|
|
|
|
if (status >= 500) return 'server-error'
|
|
|
|
|
|
return ''
|
2026-01-20 17:53:22 +08:00
|
|
|
|
}
|
2026-01-19 23:45:08 +08:00
|
|
|
|
|
2026-01-20 17:53:22 +08:00
|
|
|
|
function sendRequest() {
|
|
|
|
|
|
loading.value = true
|
2026-02-01 23:42:12 +08:00
|
|
|
|
response.value = null
|
|
|
|
|
|
|
2026-01-20 08:51:04 +08:00
|
|
|
|
setTimeout(() => {
|
2026-01-20 17:53:22 +08:00
|
|
|
|
loading.value = false
|
2026-01-19 23:45:08 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
if (!apiKey.value) {
|
|
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 401,
|
|
|
|
|
|
statusText: 'Unauthorized',
|
|
|
|
|
|
data: { error: 'Invalid API key' },
|
|
|
|
|
|
explanation: '没带 API Key,等于没带钱就想吃饭,被拒绝了'
|
2026-01-20 08:51:04 +08:00
|
|
|
|
}
|
2026-01-19 23:45:08 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
2026-01-20 08:51:04 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
if (endpoint.value === '/users' && method.value === 'GET') {
|
|
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 200,
|
|
|
|
|
|
statusText: 'OK',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
users: [
|
|
|
|
|
|
{ id: 1, name: '张三', email: 'zhangsan@example.com' },
|
|
|
|
|
|
{ id: 2, name: '李四', email: 'lisi@example.com' },
|
|
|
|
|
|
{ id: 3, name: '王五', email: 'wangwu@example.com' }
|
|
|
|
|
|
],
|
|
|
|
|
|
total: 3
|
|
|
|
|
|
},
|
|
|
|
|
|
explanation: '成功了!服务器返回了用户列表'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (endpoint.value === '/users/123' && method.value === 'GET') {
|
|
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 200,
|
|
|
|
|
|
statusText: 'OK',
|
|
|
|
|
|
data: { id: 123, name: '张三', email: 'zhangsan@example.com' },
|
|
|
|
|
|
explanation: '找到了!服务器返回了单个用户信息'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (endpoint.value === '/posts' && method.value === 'GET') {
|
|
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 200,
|
|
|
|
|
|
statusText: 'OK',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
posts: [
|
|
|
|
|
|
{ id: 1, title: '学习 API 的第一天', author: '张三' },
|
|
|
|
|
|
{ id: 2, title: 'API 原来这么简单', author: '李四' }
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
explanation: '成功了!服务器返回了文章列表'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (endpoint.value === '/posts' && method.value === 'POST') {
|
|
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 201,
|
|
|
|
|
|
statusText: 'Created',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
id: 3,
|
|
|
|
|
|
title: '学习 API 的第一天',
|
|
|
|
|
|
author: '张三',
|
|
|
|
|
|
created_at: '2025-01-15T10:30:00Z'
|
|
|
|
|
|
},
|
|
|
|
|
|
explanation: '新建成功了!服务器返回了新创建的帖子'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (endpoint.value === '/unknown-path') {
|
|
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 404,
|
|
|
|
|
|
statusText: 'Not Found',
|
|
|
|
|
|
data: { error: 'Resource not found' },
|
|
|
|
|
|
explanation: '地址错了,这个接口不存在'
|
|
|
|
|
|
}
|
2026-02-18 17:38:10 +08:00
|
|
|
|
} else if (endpoint.value === '/users' && method.value === 'DELETE') {
|
2026-02-01 23:42:12 +08:00
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 429,
|
|
|
|
|
|
statusText: 'Too Many Requests',
|
|
|
|
|
|
data: { error: 'Rate limit exceeded' },
|
|
|
|
|
|
explanation: '点太快了!1 秒内只能请求 5 次,你超了'
|
2026-01-20 17:53:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
2026-02-01 23:42:12 +08:00
|
|
|
|
response.value = {
|
|
|
|
|
|
status: 404,
|
|
|
|
|
|
statusText: 'Not Found',
|
|
|
|
|
|
data: { error: 'Endpoint not found' },
|
|
|
|
|
|
explanation: '这个地址不存在,换一个试试?'
|
2026-01-20 08:51:04 +08:00
|
|
|
|
}
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
2026-01-20 17:53:22 +08:00
|
|
|
|
}, 500)
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.api-playground {
|
|
|
|
|
|
background: var(--vp-c-bg-soft);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-01-20 08:51:04 +08:00
|
|
|
|
border-radius: 12px;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
padding: 20px;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
margin: 24px 0;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 17:53:22 +08:00
|
|
|
|
.header {
|
2026-02-01 23:42:12 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin-bottom: 20px;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.title {
|
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
margin-bottom: 4px;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.subtitle {
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.playground-layout {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
|
gap: 20px;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
|
|
.playground-layout {
|
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
|
}
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.left-panel,
|
|
|
|
|
|
.right-panel {
|
|
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
|
padding: 16px;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.panel-title {
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.input-group {
|
|
|
|
|
|
margin-bottom: 12px;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 17:53:22 +08:00
|
|
|
|
.input-group label {
|
|
|
|
|
|
display: block;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
font-weight: 500;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
margin-bottom: 6px;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
color: var(--vp-c-text-2);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.input {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-family: monospace;
|
|
|
|
|
|
background: var(--vp-c-bg-soft);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.input:focus {
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
border-color: var(--vp-c-brand);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.textarea {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 80px;
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 6px;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
font-family: monospace;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
background: var(--vp-c-bg-soft);
|
|
|
|
|
|
resize: vertical;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.method-buttons {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
gap: 8px;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.method-btn {
|
|
|
|
|
|
padding: 6px 16px;
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
background: var(--vp-c-bg-soft);
|
2026-01-20 17:53:22 +08:00
|
|
|
|
font-size: 13px;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.2s;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.method-btn.active {
|
|
|
|
|
|
background: var(--vp-c-brand);
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
border-color: var(--vp-c-brand);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 17:53:22 +08:00
|
|
|
|
.send-btn {
|
2026-02-01 23:42:12 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 12px;
|
|
|
|
|
|
background: var(--vp-c-brand);
|
2026-01-20 17:53:22 +08:00
|
|
|
|
color: white;
|
|
|
|
|
|
border: none;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
border-radius: 6px;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
font-weight: 600;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
cursor: pointer;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
transition: opacity 0.2s;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.send-btn:disabled {
|
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
|
cursor: not-allowed;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.empty-state {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
padding: 40px 20px;
|
|
|
|
|
|
color: var(--vp-c-text-3);
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.empty-icon {
|
|
|
|
|
|
font-size: 48px;
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
opacity: 0.5;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.hint {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
opacity: 0.7;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.response-content {
|
|
|
|
|
|
animation: fadeIn 0.3s ease;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.status-bar {
|
|
|
|
|
|
padding: 8px 12px;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
align-items: center;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.status-bar.success {
|
|
|
|
|
|
background: #dcfce7;
|
|
|
|
|
|
color: #166534;
|
|
|
|
|
|
}
|
2026-01-20 17:53:22 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.status-bar.client-error {
|
|
|
|
|
|
background: #fee2e2;
|
|
|
|
|
|
color: #991b1b;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.status-bar.server-error {
|
|
|
|
|
|
background: #fecaca;
|
|
|
|
|
|
color: #7f1d1d;
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.status-code {
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
font-family: monospace;
|
|
|
|
|
|
}
|
2026-01-20 17:53:22 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.response-body {
|
2026-01-20 08:51:04 +08:00
|
|
|
|
background: #1e293b;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
padding: 12px;
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
overflow-x: auto;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
max-height: 180px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.response-body pre {
|
|
|
|
|
|
margin: 0;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
font-family: monospace;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #e2e8f0;
|
|
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.explanation {
|
|
|
|
|
|
background: var(--vp-c-bg-soft);
|
|
|
|
|
|
padding: 12px;
|
|
|
|
|
|
border-radius: 6px;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
font-size: 13px;
|
2026-02-01 23:42:12 +08:00
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
border-left: 3px solid var(--vp-c-brand);
|
2026-01-20 17:53:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
.tips {
|
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
padding-top: 16px;
|
|
|
|
|
|
border-top: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tip-title {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tip-list {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tip-list button {
|
|
|
|
|
|
padding: 6px 12px;
|
2026-01-20 17:53:22 +08:00
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-01 23:42:12 +08:00
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tip-list button:hover {
|
|
|
|
|
|
border-color: var(--vp-c-brand);
|
|
|
|
|
|
color: var(--vp-c-brand);
|
2026-01-20 17:53:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-01 23:42:12 +08:00
|
|
|
|
@keyframes fadeIn {
|
|
|
|
|
|
from {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
transform: translateY(5px);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
|
}
|
2026-01-19 23:45:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|