vue3实现移动端今日头条资讯新闻类app的ui交互效果代码

代码语言:html

所属分类:其他

代码描述:vue3实现移动端今日头条资讯新闻类app的ui交互效果代码

代码标签: vue 移动端 今日 头条 资讯 新闻 app ui 交互

下面为部分代码预览,完整代码请点击下载或在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>今日资讯</title>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue3.2.22.js"></script>
    <style>
        :root {
            --primary-color: #F53F3F; /* 头条红 */
            --background-color: #F4F5F7;
            --card-background: #FFFFFF;
            --text-color: #222222;
            --text-light: #999999;
            --border-color: #EFEFEF;
            --shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
            --border-radius: 4px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
        }

        body {
            background-color: var(--background-color);
            color: var(--text-color);
        }

        #app {
            max-width: 800px;
            margin: 0 auto;
            background-color: var(--background-color);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            padding-bottom: 60px; /* 为底部导航留出空间 */
        }
        
        .page-container {
            flex-grow: 1;
            animation: fadeIn 0.3s ease-out;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        /* 底部主导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            max-width: 800px;
            margin: 0 auto;
            height: 60px;
            background: var(--card-background);
            display: flex;
            justify-content: space-around;
            align-items: center;
            box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
            border-top: 1px solid var(--border-color);
            z-index: 1000;
        }
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-color);
            cursor: pointer;
            transition: color 0.2s;
            font-size: 12px;
        }
        .nav-item svg {
            width: 24px;
            height: 24px;
            margin-bottom: 2px;
        }
        .nav-item.active {
            color: var(--primary-color);
        }
        
        /* 首页 - 顶部类别栏 */
        .category-tabs {
            position: sticky;
            top: 0;
            background: var(--card-background);
            padding: 0 10px;
            white-space: nowrap;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            border-bottom: 1px solid var(--border-color);
            z-index: 999;
        }
        .category-tabs::-webkit-scrollbar { display: none; } /* 隐藏滚动条 */
        .tab-item {
            display: inline-block;
            padding: 15px 10px;
            margin: 0 5px;
            font-size: 16px;
            cursor: pointer;
            color: var(--text-light);
            position: relative;
        }
        .tab-item.active {
            color: var(--primary-color);
            font-weight: 600;
        }
        .tab-item.active::after {
            content: '';
            position: absolute;
            bottom: 5px;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 3px;
            background-color: var(--primary-color);
            border-radius: 2px;
        }

        /* 新闻卡片 */
        .article-card {
            background: var(--card-background);
            padding: 15px;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
        }
        .article-card:hover { background-color: #fafafa; }
        .article-content-no-img { display: flex; flex-direction: column; }
        .article-content-with-img { display: flex; justify-content: space-between; gap: 15px; }
        .article-title {
            font-size: 17px;
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            margin-bottom: 10px;
        }
        .article-details {
            display: flex;
            flex-grow: 1;
            flex-direction: column;
            justify-content: space-between;
        }
        .article-meta {
            font-size: 12px;
            color: var(--text-light);
        }
        .article-thumbnail {
            width: 110px;
            height: 75px;
            object-fit: cover;
            border-radius: var(--border-radius);
            fle.........完整代码请登录后点击上方下载按钮下载查看

网友评论0