css+localStorage存储多组聊天对话记录示例代码

代码语言:html

所属分类:布局界面

代码描述:css+localStorage存储多组聊天对话记录示例代码

代码标签: css localStorage 存储 多组 聊天 对话 记录 示例 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Chat - LocalStorage 示例</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            height: 100vh;
            overflow: hidden;
            background-color: #f7f7f7;
        }
        .container {
            display: flex;
            height: 100%;
        }
        .sidebar {
            width: 280px;
            background-color: #2c3e50;
            color: #ecf0f1;
            padding: 20px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
        }
        .sidebar h2 {
            margin-top: 0;
            border-bottom: 1px solid #34495e;
            padding-bottom: 15px;
            font-size: 1.2em;
        }
        .new-chat-btn {
            display: block;
            width: 100%;
            padding: 12px;
            background-color: #3498db;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin-bottom: 20px;
            font-size: 1em;
            transition: background-color 0.3s;
        }
        .new-chat-btn:hover {
            background-color: #2980b9;
        }
        .chat-list {
            flex-grow: 1;
            overflow-y: auto;
        }
        .chat-list-item {
            padding: 12px 15px;
            margin-bottom: 10px;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .chat-list-item.active, .chat-list-item:hover {
            background-color: #34495e;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0