index.js 1.52 KB
Newer Older
wanli's avatar
wanli committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
import "./index.less";
import RightContent from "@/components/GlobalHeader/RightContent";
import BaseMenu from "@/components/SiderMenu/BaseMenu";
const TopNavHeader = {
  props: ["menuData", "logo", "theme", "contentWidth", "layout", "title"],
  computed: {
    maxWidth() {
      return (
        (this.contentWidth === "Fixed" ? 1200 : window.innerWidth) -
        330 -
        165 -
        4 -
        36
      );
    },
  },
  render() {
    const {
      maxWidth,
      menuData,
      logo,
      theme = "dark",
      contentWidth = "Fixed",
      layout,
wanli's avatar
wanli committed
25
      title = "admin",
wanli's avatar
wanli committed
26 27 28 29 30 31 32 33 34
    } = this;
    return (
      <div class="top-nav-header">
        <div class={`head ${theme === "light" ? "light" : ""}`}>
          <div class={`main ${contentWidth === "Fixed" ? "wide" : ""}`}>
            <div class="left">
              <div class="logo">
                <router-link to="/">
                  <img src={logo} alt="logo" />
wanli's avatar
wanli committed
35
                  <h1>{title}</h1>
wanli's avatar
wanli committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
                </router-link>
              </div>
              <div
                style={{
                  maxWidth,
                }}
              >
                <BaseMenu
                  theme={theme}
                  layout={layout}
                  mode="horizontal"
                  menuData={menuData}
                  styles="border: 'none'; height: 64px"
                />
              </div>
            </div>
            <RightContent theme={theme} layout={layout} />
          </div>
        </div>
      </div>
    );
  },
};
export default TopNavHeader;