Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

vue写一个美观的上左右结果的框架

  1. User

    vue写一个美观的上左右结果的框架

  2. Assistant

    这里提供一种可能的实现方式,具体要根据实际需求来进行定制:

    <template>
      <div class="wrapper">
        <div class="header">Header</div>
        <div class="content">
          <div class="sidebar">Sidebar</div>
          <div class="main">Main Content</div>
        </div>
        <div class="footer">Footer</div>
      </div>
    </template>
    
    <style>
    .wrapper {
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }
    
    .header {
      height: 80px;
      background-color: #333;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
    }
    
    .content {
      flex: 1;
      display: flex;
      flex-direction: row;
    }
    
    .sidebar {
      width: 200px;
      height: calc(100vh - 80px - 100px);
      background-color: #f5f5f5;
    }
    
    .main {
      flex: 1;
      height: calc(100vh - 80px - 100px);
      padding: 20px;
      background-color: #fff;
      box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    }
    
    .footer {
      height: 100px;
      background-color: #333;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    </style>
    

    这里使用的是 Flex 布局来实现上左右布局,通过设置 Header 和 Footer 的高度以及 Sidebar 和 Main 的高度,使得它们在不同屏幕尺寸下占据合适的空间,达到美观的效果。具体实现还可以进行细节调整,例如添加响应式设计,设置字体、颜色等样式等。