Commit 0af1634c authored by KesaubeEire's avatar KesaubeEire

feat: 卡片图片路径错误重新引导.

parent 8635c2dd
<script>
import { toast } from '@zerodevx/svelte-toast';
import { _tagTrans } from '../stores';
/**父属性: 主标题*/
......@@ -46,10 +47,28 @@
fetch(folder + '/rpg_info/info.json', { method: 'GET' })
.then(response => response.json())
.then(data => {
console.log(data);
console.log(title, data);
// window.open(folder + '/rpg_info/' + data[1]);
});
}
/**图片错误处理*/
function picErrorHandler() {
_picError = true;
fetch(folder + '/rpg_info/info.json', { method: 'GET' })
.then(response => response.json())
.then(data => {
console.log('> 更正图片:\t', title, folder, data);
cover = folder + '/rpg_info/' + data[0];
// window.open(folder + '/rpg_info/' + data[1]);
})
.catch(err => {
cover = '/favicon.ico';
console.log(err);
toast.push(`Error报错:\t[${err.toString()}]`);
});
}
</script>
<div class="card w-80 bg-primary text-primary-content shadow-xl">
......@@ -59,10 +78,7 @@
src={cover ?? '/favicon.ico'}
alt={title ?? 'default alt'}
style={_picError ? 'height: 240px; width: 320px;' : ''}
on:error={() => {
cover = '/favicon.ico';
_picError = true;
}}
on:error={picErrorHandler}
on:click={getInfoPics}
on:keypress={() => {}}
/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment