npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tanzhenxing/zx-page-header

v1.0.2

Published

页头组件,显示当前页面的标题,具有返回功能

Readme

zx-page-header 页头组件

如果页面的路径比较简单,推荐使用页头组件而非面包屑组件。

安装方式

本组件符合easycom规范,HBuilderX 2.5.5起,只需将本组件导入项目,在页面template中即可直接使用,无需在页面中import和注册components

基本用法

<zx-page-header @back="goBack">
  <template #content>
    <text>标题</text>
  </template>
</zx-page-header>
const goBack = () => {
  uni.navigateBack();
}

自定义图标

默认图标可能无法满足您的需求,您可以通过设置icon属性来自定义图标。

<zx-page-header icon="left" @back="goBack">
  <template #content>
    <text>标题</text>
  </template>
</zx-page-header>

无图标

有时,页面全是元素,您可能不想展示页面上方的图标,您可以设置icon属性值为空字符串来去除它。

<zx-page-header icon="" @back="goBack">
  <template #content>
    <text>标题</text>
  </template>
</zx-page-header>

面包屑导航

使用页头组件,您可以通过添加插槽 breadcrumb 来设置面包屑路由导航。

<zx-page-header @back="goBack">
  <template #breadcrumb>
    <zx-breadcrumb separator="/">
      <zx-breadcrumb-item to="/pages/index/index">首页</zx-breadcrumb-item>
      <zx-breadcrumb-item to="/pages/components/index">组件</zx-breadcrumb-item>
      <zx-breadcrumb-item>页头</zx-breadcrumb-item>
    </zx-breadcrumb>
  </template>
  <template #content>
    <text>标题</text>
  </template>
</zx-page-header>

额外操作部分

头部可能会变得很复杂,您可以在头部添加更多的区块,以允许丰富的交互。

<zx-page-header @back="goBack">
  <template #content>
    <view class="content-with-avatar">
      <image class="avatar" src="https://cdn.uviewui.com/uview/album/1.jpg" mode="aspectFill"></image>
      <view class="title-container">
        <text class="title">标题</text>
        <text class="subtitle">副标题</text>
        <zx-tag type="primary" size="small">标签</zx-tag>
      </view>
    </view>
  </template>
  <template #extra>
    <view class="extra-buttons">
      <button size="mini" @click="handlePrint">打印</button>
      <button size="mini" type="primary" @click="handleEdit">编辑</button>
    </view>
  </template>
</zx-page-header>

主要内容

有时我们想让页头显示一些协同响应内容,我们可以使用 default 插槽。

<zx-page-header @back="goBack">
  <template #content>
    <text>标题</text>
  </template>
  <view class="page-content">
    <text class="content-text">您可以在此处添加任何内容,这部分将作为页头的主体内容显示。</text>
  </view>
</zx-page-header>

组件插槽结构

本组件由这些部件构成:

<template>
  <zx-page-header>
    <!-- 第1行 -->
    <template #breadcrumb />
    <!-- 第2行 -->
    <template #icon />
    <template #title />
    <template #content />
    <template #extra />
    <!-- 第2行之后 -->
    <template #default />
  </zx-page-header>
</template>

API

属性

| 参数 | 说明 | 类型 | 默认值 | | ------- | ---------------------------------- | ------- | ----------- | | icon | 页头的图标名称,为空字符串则不显示 | String | arrow-left | | title | 页头的主标题 | String | 返回 | | content | 页头的内容 | String | - | | size | 尺寸:large、default、small | String | default |

事件

| 事件名 | 说明 | 回调参数 | | ------ | -------------- | -------- | | back | 点击左侧区域触发 | - |

插槽

| 名称 | 说明 | | ---------- | ------------ | | icon | 图标内容 | | title | 标题内容 | | content | 内容 | | extra | 扩展设置 | | breadcrumb | 面包屑导航内容 | | default | 默认内容 |

示例

完整示例请参考 页头组件示例