Files
pro-go-study/24-httpserver/httpserver/templates/products.html
yanzuoguang 85fa81daef fix(products):修复编辑链接查询参数格式
- 将编辑链接中的路径分隔符改为查询参数格式
- 确保索引参数正确传递到编辑页面
- 统一 URL 参数的拼接方式
2025-10-25 22:01:37 +08:00

37 lines
905 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pro Go</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="m-1 p-2 bg-primary text-white h2 text-center">
Products
</div>
<table class="table table-sm table-bordered table-striped">
<thead>
<tr>
<th>Index</th>
<th>Name</th>
<th>Category</th>
<th class="text-end">Price</th>
<th class="text-center">Description</th>
</tr>
</thead>
<tbody>
{{ range $index,$product := .Data }}
<tr>
<td>{{ $index }}</td>
<td>{{ $product.Name }}</td>
<td>{{ $product.Category }}</td>
<td class="text-end">{{ printf "$%.2f" $product.Price }}</td>
<th class="text-center"><a href="edit.html?index={{ $index }}">Edit</a></th>
</tr>
{{ end }}
</tbody>
</table>
</body>
</html>