首页导航栏样式 案例

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;
    width: 60px;
  }

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

posted @ 2021-07-18 22:31  thomas_blog  阅读(82)  评论(0编辑  收藏  举报