Skip to content

Commit

Permalink
Merge pull request #10 from BeiyanYunyi/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
BeiyanYunyi committed Dec 23, 2023
2 parents 6ba3da0 + f214bb8 commit 656de17
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules\\typescript\\lib",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"css.customData": ["./css-data.json"]
}
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand All @@ -10,7 +10,9 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
阅读量: <span id="/" class="waline-pageview-count"></span> 评论数:
<span id="/" class="waline-comment-count"></span>
<span id="/" class="waline-comment-count"></span>页面阅读量 1:
<span class="waline-pageview-count" data-path="/guide/features/pageview.html"></span>页面阅读量
2:<span class="waline-pageview-count" data-path="/guide/features/i18n.html"></span>
<div id="root"></div>
<script type="module">
import Sodesu from '/src/index.tsx';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sodesu-comment",
"version": "0.0.2",
"version": "0.0.3",
"description": "Comment system with SolidJS",
"packageManager": "[email protected]",
"type": "module",
Expand Down
8 changes: 7 additions & 1 deletion src/waline/pageview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ export { type WalineAbort } from './typings/index.js';

const renderVisitorCount = (counts: number[], countElements: HTMLElement[]): void => {
countElements.forEach((element, index) => {
element.innerText = counts[index].toString();
if (typeof counts[index] === 'number') {
element.innerText = counts[index].toString();
} else {
element.innerText = (counts[0] as unknown as { data: { time: number }[] }).data[
index
].time.toString();
}
});
};

Expand Down

0 comments on commit 656de17

Please sign in to comment.