| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Juris 计数器 Demo</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
- margin: 0;
- background-color: #f5f5f5;
- }
- #app {
- text-align: center;
- }
- .counter {
- font-size: 3rem;
- font-weight: bold;
- color: #333;
- cursor: pointer;
- padding: 20px;
- border: 2px solid #ddd;
- border-radius: 10px;
- background-color: white;
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
- transition: all 0.2s ease;
- }
- .counter:hover {
- background-color: #f0f0f0;
- transform: translateY(-2px);
- }
- .counter:active {
- transform: translateY(0);
- }
- </style>
- </head>
- <body>
- <div id="app"></div>
- <script src="https://unpkg.com/juris"></script>
- <script>
- const app = new Juris({
- states: { count: 0 },
- layout: {
- div: {
- className: 'counter',
- text: () => `点击次数: ${app.getState('count', 0)}`,
- onclick: () => app.setState('count', app.getState('count', 0) + 1)
- }
- }
- });
- app.render('#app');
- </script>
- </body>
- </html>
|