import { use, noop } from '../utils'; import { inherit } from '../utils/functional'; import Icon from '../icon'; // Types import { CreateElement, RenderContext } from 'vue/types'; import { ScopedSlot, DefaultSlots } from '../utils/use/sfc'; export type NavBarProps = { title?: string; fixed?: boolean; zIndex: number; border: boolean; leftText?: string; rightText?: string; leftArrow?: boolean; }; export type NavBarSlots = DefaultSlots & { left?: ScopedSlot; title?: ScopedSlot; right?: ScopedSlot; }; export type NavBarEvents = { 'click-left'?(event: Event): void; 'click-right'?(event: Event): void; }; const [sfc, bem] = use('nav-bar'); function NavBar( h: CreateElement, props: NavBarProps, slots: NavBarSlots, ctx: RenderContext ) { return (
{slots.left ? slots.left() : [ props.leftArrow && ( ), props.leftText && ( {props.leftText} ) ]}
{slots.title ? slots.title() : props.title}
{slots.right ? slots.right() : props.rightText && ( {props.rightText} )}
); } NavBar.props = { title: String, fixed: Boolean, leftText: String, rightText: String, leftArrow: Boolean, border: { type: Boolean, default: true }, zIndex: { type: Number, default: 1 } }; export default sfc(NavBar);