2
0

index.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Juris 计数器 Demo</title>
  7. <style>
  8. body {
  9. font-family: Arial, sans-serif;
  10. display: flex;
  11. justify-content: center;
  12. align-items: center;
  13. min-height: 100vh;
  14. margin: 0;
  15. background-color: #f5f5f5;
  16. }
  17. #app {
  18. text-align: center;
  19. }
  20. .counter {
  21. font-size: 3rem;
  22. font-weight: bold;
  23. color: #333;
  24. cursor: pointer;
  25. padding: 20px;
  26. border: 2px solid #ddd;
  27. border-radius: 10px;
  28. background-color: white;
  29. box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  30. transition: all 0.2s ease;
  31. }
  32. .counter:hover {
  33. background-color: #f0f0f0;
  34. transform: translateY(-2px);
  35. }
  36. .counter:active {
  37. transform: translateY(0);
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <div id="app"></div>
  43. <script src="https://unpkg.com/juris"></script>
  44. <script>
  45. const app = new Juris({
  46. states: { count: 0 },
  47. layout: {
  48. div: {
  49. className: 'counter',
  50. text: () => `点击次数: ${app.getState('count', 0)}`,
  51. onclick: () => app.setState('count', app.getState('count', 0) + 1)
  52. }
  53. }
  54. });
  55. app.render('#app');
  56. </script>
  57. </body>
  58. </html>