Extract project examples to JSON file and add time-tracker example

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 22:24:56 +00:00
parent 5888cc76d3
commit 7f6dafeab6
2 changed files with 28 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import examples from '../examples.json'
const emit = defineEmits<{
submit: [requirement: string]
@@ -9,12 +10,6 @@ const emit = defineEmits<{
const requirement = ref('')
const inputEl = ref<HTMLTextAreaElement>()
const examples = [
{ label: 'Todo 应用', text: '做一个 Todo List 应用:前端展示任务列表(支持添加、完成、删除),后端 FastAPI 提供增删改查 REST API数据存 SQLite。完成后用 curl 跑一遍 E2E 测试验证所有接口正常。' },
{ label: '贪吃蛇+排行榜', text: '做一个贪吃蛇游戏网站,前端用 HTML/JS后端用 FastAPI 存储排行榜,支持提交分数和查看 Top10' },
{ label: '抓取豆瓣 Top250', text: '用 Python 抓取豆瓣电影 Top250 并生成分析报告' },
]
onMounted(() => inputEl.value?.focus())
function onSubmit() {
@@ -31,7 +26,7 @@ function onSubmit() {
v-for="ex in examples"
:key="ex.label"
class="example-tag"
@click="requirement = ex.text"
@click="requirement = Array.isArray(ex.text) ? ex.text.join('\n') : ex.text"
>{{ ex.label }}</span>
</div>
<textarea