Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
imzlh committed Feb 5, 2025
1 parent 63151dd commit 0ae4d49
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oneblog",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/components/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="list">
<RouterLink :to="{ name: 'post-by-id', params: { id: post.name } }" class="card" v-for="post in posts"
:key="post.created.toString()">
<img :src="get_thumb(post)" :alt="post.title">
<img :src="get_thumb(post)." :alt="post.title">
<div class="more">
<h1>{{ post.title }}</h1>
<span class="time">{{ generate_date(post) }}</span>
Expand Down
6 changes: 3 additions & 3 deletions src/utils/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ export function get_thumb(post: IPost){
case 'seqnum':
if(typeof $t.url != 'string') throw new Error('URL should be a string when using seqnum type');
const index = Math.round(Math.random() * ($t.range[1] - $t.range[0])) + $t.range[1];
return get_file($t.url.replace('%u', index.toString().padStart($t.pad, '0')));
return get_file($t.url.replace('%u', index.toString().padStart($t.pad, '0'))).href;

case 'fixed':
if((typeof $t.url == 'string') && $t.url.length != 0)
throwError('URL should be an array that contains multiple URLs when using fixed type');
return get_file($t.url[Math.floor(Math.random() * $t.url.length)]);
return get_file($t.url[Math.floor(Math.random() * $t.url.length)]).href;

default:
if(typeof $t.url != 'string')
throwError('URL should be a string.\nIf you want to randomly select from multiple URLs, use `seqnum` or `fixed` type.')
return get_file($t.url as string);
return get_file($t.url as string).href;
}
}
// 遵循PHP写法
Expand Down

0 comments on commit 0ae4d49

Please sign in to comment.