首页导航栏样式 案例

NavBar.vue

<template>
  <div class="nav-bar">
    <div class="left">
      <slot name="left"></slot>
    </div>
    <div class="mid">
      <slot name="mid"></slot>
    </div>
    <div class="right">
      <slot name="right"></slot>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'NavBar',
    data() {
      return {
        msg: 'hello NavBar!'
      }
    }
  }
</script>

<style>
  .nav-bar {
    display: flex;
    height: 45px;
    /* div中的文字垂直居中 */
    line-height: 45px;
  }

  .left,
  .right {
    background-color: red;
     60px;
  }

  .mid {
    background-color: yellow;
    flex: 1;
  }
</style>

原文地址:https://www.cnblogs.com/zhangxuechao/p/15028078.html