fix: add page perfect

This commit is contained in:
2024-11-30 02:21:33 +08:00
parent ebf0b230b1
commit 4148d162e4
6 changed files with 177 additions and 9 deletions

16
demo/index.html Normal file
View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo Page</title>
</head>
<body>
<h1>Welcome to the Demo Page</h1>
<p>This is a basic HTML template.</p>
<script src="./src/index.ts" type="module"></script>
</body>
</html>

16
demo/package.json Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "demo",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"dev": "vite"
},
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me>",
"license": "MIT",
"type": "module",
"dependencies": {
"@kevisual/store": "link:.."
}
}

17
demo/src/index.ts Normal file
View File

@@ -0,0 +1,17 @@
console.log('index.js');
import { Page } from '@kevisual/store/page';
const page = new Page({
isListen: true,
});
page.addPage('/:id', 'user');
page.subscribe('user', (params, state) => {
console.log('user', params, 'state', state);
return;
});
// page.navigate('/c', { id: 3 });
// page.navigate('/c', { id: 2 });
// page.refresh();