vue3布局模拟mac操作系统桌面ui交互原型代码

代码语言:html

所属分类:布局界面

代码描述:vue3布局模拟mac操作系统桌面ui交互原型代码

代码标签: vue 布局 模拟 mac 操作 系统 桌面 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>MacOS UI 原型</title>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue.global.prod.3.5.17.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/echarts.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            height: 100vh;
            overflow: hidden;
        }

        .desktop {
            width: 100%;
            height: 100vh;
            position: relative;
            background-image: url('https://picsum.photos/1920/1080?blur=1');
            background-size: cover;
            background-position: center;
        }

        .menu-bar {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 28px;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(20px);
            color: white;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 16px;
            font-size: 14px;
            z-index: 1000;
        }

        .menu-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .menu-right {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .apple-logo {
            font-size: 16px;
        }

        .dock {
            position: fixed;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(20px);
            border-radius: 16px;
            padding: 8px;
            display: flex;
            gap: 8px;
            border: 1px solid rgba(255, 255, 255, 0.3);
            z-index: 999;
        }

        .dock-item {
            width: 56px;
            height: 56px;
            border-radius: 12px;
            background: linear-gradient(145deg, #f0f0f0, #d0d0d0);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .dock-item:hover {
            transform: translateY(-8px) scale(1.1);
        }

        .dock-item svg {
            width: 32px;
            height: 32px;
        }

        .window {
            position: absolute;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 12px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.3);
            overflow: hidden;
            min-width: 600px;
            min-height: 400px;
            z-index: 500;
        }

        .window-header {
            height: 40px;
            background: rgba(0, 0, 0, 0.05);
            display: flex;
            align-items: center;
            padding: 0 16px;
            cursor: move;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .window-controls {
            display: flex;
            gap: 8px;
        }

        .window-control {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            cursor: pointer;
        }

        .control-close { background: #ff5f56; }
        .control-minimize { background: #ffbd2e; }
        .control-maximize { background: #27ca3f; }

        .window-title {
            flex: 1;
            text-align: center;
            font-weight: 500;
            font-size: 14px;
        }

        .window-content {
            padding: 20px;
            height: calc(100% - 40px);
            overflow-y: auto;
        }

        .app-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
            gap: 20px;
            padding: 40px;
        }

        .app-icon {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .app-icon:hover {
            transform: scale(1.1);
        }

        .app-icon-image {
            width: 64px;
            height: 64px;
            border-radius: 12px;
            background: linear-gradient(145deg, #f0f0f0, #d0d0d0);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .app-name {
            color: white;
            font-size: 12px;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
        }

        .folder {
            width: 300px;
            height: 200px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 8px;
            padding: 16px;
            position: absolute;
            top: 100px;
            left: 100px;
            z-index: 600;
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-group label {
            display: block;
            margin-bottom: 4px;
            font-weight: 500;
        }

        .form-group input, .form-group textarea, .form-group select {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
        }

        .btn {
            background: #007aff;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .btn:hover {
            background: #0056b3;
        }

        .btn-secondary {
            background: #6c757d;
        }

        .btn-secondary:hover {
            background: #545b62;
        }

        .btn-danger {
            background: #dc3545;
        }

        .btn-danger:hover {
            background: #c82333;
        }

        .file-list {
            max-height: 300px;
            overflow-y: auto;
        }

        .file-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 8px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .file-item:hover {
            background: rgba(0, 122, 255, 0.1);
        }

        .file-icon {
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .tabs {
            display: flex;
            border-bottom: 1px solid #ddd;
            margin-bottom: 20px;
        }

        .tab {
            padding: 10px 20px;
            background: none;
            border: none;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: all 0.3s ease;
        }

        .tab.active {
            border-bottom-color: #007aff;
            color: #007aff;
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        .chart-container {
            width: 100%;
            height: 300px;
            margin-top: 20px;
        }

        .status-indicator {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #27ca3f;
            display: inline-block;
            margin-right: 8px;
        }

        .notification {
            position: fixed;
            top: 40px;
            right: 16px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 8px;
            padding: 16px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            z-index: 1001;
            min-width: 300px;
        }

        .dragging {
            opacity: 0.8;
            transform: rotate(2deg);
        }

        @media (max-width: 768px) {
            .window {
                min-width: 90vw;
                min-height: 70vh;
            }
            
            .dock {
                bottom: 4px;
                padding: 4px;
            }
            
            .dock-item {
                width: 48px;
                height: 48px;
            }
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 桌面 -->
        <div class="desktop" @click="closeAllMenus">
            <!-- 顶部菜单栏 -->
            <div class="menu-bar">
                <div class="menu-left">
                    <span class="apple-logo">🍎</span>
                    <span>访达</span>
                    <span>文件</span>
                    <span>编辑</span>
                    <span>显示</span>
                    <span>前往</span>
                    <span>窗口</span>
                    <span>帮助</span>
                </div>
                <div class="menu-right">
                    <span>🔍</span>
                    <span>🔊</span>
                    <span>🔋100%</span>
                    <span>📶</span>
                    <span>{{ currentTime }}</span>
                </div>
            </div>

            <!-- 桌面应用图标 -->
            <div class="app-grid">
                <div class="app-icon" @click="openApp('finder')" v-for="app in desktopApps" :key="app.id">
                    <div class="app-icon-image">
                        <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                            <path v-html="app.icon"></path>
                      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0