Fix Link bug: Replace <a> with <Link> and add more demo page(dl.html)

This commit is contained in:
oom 2026-10-27 13:24:15 +07:00
parent 69d83ea493
commit ce646ffc20
4 changed files with 50 additions and 17 deletions

View file

@ -1,5 +1,6 @@
// app/page.tsx (ระบบ B)
'use client';
import Link from "next/link";
import type { ChangeEvent } from 'react';
// import { createDownloadFormAction } from './actions';
import DependentDropdown, { DropdownData } from '@/components/utils/DependentDropdown';
@ -25,10 +26,10 @@ export default function HomePage() {
<div>
ตัวอย่าง Frontend ส่งข้อมูลผ่าน &lt;form&gt;(POST) หรือ &lt;a&gt;(GET)
เพื่อรองรับ Vanilla JavaScript และ Classic Framework ใช้การเปลี่ยนหน้าเพื่อดาว์นโหลดไฟล์
ต้องทำให้ ASP.NET มีฟังก์ชั่นเหมือน /docedit/api/template/download-docx
ตัวอย่างหน้าแบบ <Link href='/tmpl/dl.html'>Plain HTML</Link>
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<form action="../api/template/download-docx" method="POST">
<form action="/docedit/api/template/download-docx" method="POST">
<h2 className="font-semibold text-blue-600 mb-2">Form POST</h2>
<DependentDropdown data={templateData} name1='tid' name2='fid'
label1="Template(tid):" label2="ข้อมูล(fid):" onSelectChange={handleTmplSelect} />
@ -55,23 +56,23 @@ export default function HomePage() {
</form>
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">A Link Get</h2>
<a href="../api/template/download-docx?tid=T_X&fid=T_no_warning&uid=john&uname=John%20Doe">T_no_warning_john_xxx.docx</a><br/>
<a href="../api/template/download-docx?tid=T_X&fid=TF_no_warning_P2&uid=john&uname=John%20Doe">TF_no_warning_P2_john_xxx.docx</a><br/>
<a href="../api/template/download-docx?tid=T_X&fid=TS_P2_IN&uid=john&uname=John%20Doe">TS_P2_IN_john_xxx.docx</a><br/>
<h2 className="font-semibold text-blue-600 mb-2">A Link Get(new)</h2>
<Link href="/api/template/download-docx?tid=T_X&fid=T_no_warning&uid=john&uname=John%20Doe">T_no_warning_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T_X&fid=TF_no_warning_P2&uid=john&uname=John%20Doe">TF_no_warning_P2_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T_X&fid=TS_P2_IN&uid=john&uname=John%20Doe">TS_P2_IN_john_xxx.docx</Link><br/>
<a href="../api/template/download-docx?tid=T12_X&fid=T12_b2_IN&uid=john&uname=John%20Doe">T12_b2_IN_john_xxx.docx</a><br/>
<a href="../api/template/download-docx?tid=T12_X&fid=T12_FD155_3s-long&uid=john&uname=John%20Doe">T12_FD155_3s-long_john_xxx.docx</a><br/>
<Link href="/api/template/download-docx?tid=T12_X&fid=T12_b2_IN&uid=john&uname=John%20Doe">T12_b2_IN_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T12_X&fid=T12_FD155_3s-long&uid=john&uname=John%20Doe">T12_FD155_3s-long_john_xxx.docx</Link><br/>
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">Template & Data</h2>
Template: <a href="../tmpl/T_X.docx">T_X.docx</a>, &nbsp;
<a href="../tmpl/T12_X.docx">T12_X.docx</a><br/>
Data: <a href="../tmpl/TF_no_warning_P2.json">TF_no_warning_P2.json</a>, &nbsp;
<a href="../tmpl/T_no_warning.json">T_no_warning.json</a>, &nbsp;
<a href="../tmpl/TS_P2_IN.json">TS_P2_IN.json</a><br/>
<a href="../tmpl/T12_b2_IN.json">T12_b2_IN.json</a>, &nbsp;
<a href="../tmpl/T12_FD155_3s-long.json">T12_FD155_3s-long.json</a>
Template: <Link href="/tmpl/T_X.docx">T_X.docx</Link>, &nbsp;
<Link href="/tmpl/T12_X.docx">T12_X.docx</Link><br/>
Data: <Link href="tmpl/TF_no_warning_P2.json">TF_no_warning_P2.json</Link>, &nbsp;
<Link href="/tmpl/T_no_warning.json">T_no_warning.json</Link>, &nbsp;
<Link href="/tmpl/TS_P2_IN.json">TS_P2_IN.json</Link><br/>
<Link href="/tmpl/T12_b2_IN.json">T12_b2_IN.json</Link>, &nbsp;
<Link href="/tmpl/T12_FD155_3s-long.json">T12_FD155_3s-long.json</Link>
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">Flow</h2>