添加缓存禁用机制,每次刷新加载最新JSON

This commit is contained in:
openclaw 2026-03-25 11:27:45 +08:00
parent 8a12e984ee
commit d9f8da5292

View File

@ -317,10 +317,15 @@
let chaptersData = [];
// 获取带缓存禁用的时间戳
function getCacheBuster() {
return `?t=${Date.now()}`;
}
// 加载章节列表
async function loadChaptersIndex() {
try {
const response = await fetch('data/chapters.json');
const response = await fetch('data/chapters.json' + getCacheBuster());
const data = await response.json();
chaptersData = data.chapters;
renderSidebar();
@ -343,7 +348,7 @@
currentChapter = id;
try {
const response = await fetch(`data/chapter-${String(id).padStart(2, '0')}.json`);
const response = await fetch(`data/chapter-${String(id).padStart(2, '0')}.json` + getCacheBuster());
const chapter = await response.json();
// 将纯文本转换为HTML每段包裹<p>标签)