zoukankan      html  css  js  c++  java
  • vue 头部header封装

    <template>
    <header class="header">
    <!-- 左侧返回按钮 -->
    <div class="header-button is-left" v-show="isLeft">
    <i class="fa fa-chevron-left"></i>
    <button @click="$router.go(-1)">返回</button>
    </div>
    <!-- 标题 -->
    <h1 class="header-title">{{title}}</h1>
    <!-- 右侧图标 -->
    <div class="header-button is-right" v-show="btn_icon">
    <button @click="$emit('rightClick')">
    <i :class="'fa fa-'+ btn_icon"></i>
    </button>
    </div>
    </header>
    </template>

    <script>
    export default {
    name: "Hader",
    props: {
    title: String,
    isLeft: {
    type: Boolean,
    default: false
    },
    btn_icon: String
    }
    };
    </script>

    <style scoped>
    .header {
    align-items: center;
    background-color:#F98A05;
    box-sizing: border-box;
    color: #fff;
    display: flex;
    font-size: 16px;
    height: 45px;
    line-height: 1;
    padding: 0 10px;
    position: relative;
    text-align: center;
    white-space: nowrap;
    position: fixed;
    100%;
    top: 0;
    z-index: 99;
    }

    .header-button button {
    background-color: transparent;
    border: 0;
    box-shadow: none;
    color: inherit;
    display: inline-block;
    padding: 0;
    font-size: inherit;
    outline: none;
    }
    .header-title {
    flex: 1;
    }
    .is-left {
    text-align: left;
    }
    .is-right {
    text-align: right;
    }
    </style>

    使用

    <Header :title="title" :isLeft="true" />

  • 相关阅读:
    Eclipse配置Maven详细教程
    Spring MVC 搭建web项目示例
    C# Action 和Func
    C# params 用法简介
    WPF绘图性能问题
    C# EventWaitHandle用法
    C#5.0 异步编程async/await用法
    通过Struts2Web应用框架深入理解MVC
    Java过滤器—Filter用法简介
    WPF内嵌CEF控件,与JS交互
  • 原文地址:https://www.cnblogs.com/xzhce/p/13645178.html
Copyright © 2011-2022 走看看