0.0.9 • Published 6 years ago

@minidesign/header v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

@minidesign/header

微信小程序自定义header

  • npm.io
  • npm.io

Install

  • 从小程序基础库版本 2.2.1 或以上、及开发者工具 1.02.1808300 或以上开始,小程序支持使用 npm 安装第三方包
  • 如果你的不支持,那么可以先下载下来,在手动拷贝到你的components/header文件夹下,在使用的细节上调整一下就行了。
  1. npm install --save @minidesign/header
  2. 【微信开发者工具】->【工具】-> 【构建 npm】
  3. ok. (别忘记执行【构建 npm】步骤)

Usage

page.json

{
  "usingComponents": {
    "header": "@minidesign/header"
  }
}

page.wxml

<header>Minidesign Header</header>

属性参数

NameTypeDefaultDescription
modestring'classic'模式,可选值: 'fashion' | 'classic' | 'cover-fashion' | 'cover-classic' | 'custom' | 'cover-custom'
titlestring / void''标题,默认取小程序app.json文件的配置值,会覆盖默认slot
backgroundcolorstring / void'#ffffff'背景颜色,正确的颜色值都可
animationAnimationData / void{}动画 Data
heightnumber / void自适应头部高度,默认自适应,推荐默认
homestring / void'pages/index/index'首页按钮的路由,仅在 mode="fashion"时有效,默认自动识别小程序配置文件的首页,当 API 无效时获取该值
container-classstring / void''容器样式
title-classstring / void''标题样式
left-classstring / void''左边菜单容器样式
menu-classstring / void''菜单样式,仅在 mode="fashion"时有效
menustylestring / void'dark'菜单模式选择,可选值:'dark' | 'light',仅在mode = 'fashion' | 'cover-fashion' | 'classic' | 'cover-classic'时有效

Mode 值说明

fashion,流行模式

npm.io

拥有胶囊菜单,包含【返回】、【首页】两大功能,自动识别当前为首页时菜单不展示

classic,经典模式

npm.io

拥有经典返回菜单,包含【返回】功能,自动识别当前为首页时菜单不展示。

cover-fashion,流行覆盖模式

fashioncover-view版本,用于覆盖微信小程序原生组建

cover-classic,经典覆盖模式

classiccover-view版本,用于覆盖微信小程序原生组建

custom,自定义模式

自定义模式,可完全自定义左侧菜单和中间标题。

cover-custom,自定义覆盖模式

customcover-view版本,用于覆盖微信小程序原生组建

Slot 说明

默认Slot<slot></slot>

默认的slot会放置在title即标题的地方,同时,若设置了title属性,则忽略默认slot

<header>这里是默认的slot</header>

自定义Slot<slot name="left"></slot><slot name="title"></slot>

自定义 slot 在mode属性为custom | cover-custom时起效,为left左侧菜、title标题。

<header>
  <view slot="left">Back</view>
  <view slot="title">Minidesign</view>
</header>
0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.2-alpha.0

6 years ago

0.0.1

6 years ago

0.0.1-alpha.21

6 years ago

0.0.1-alpha.20

7 years ago

0.0.1-alpha.19

7 years ago

0.0.1-alpha.18

7 years ago

0.0.1-alpha.17

7 years ago

0.0.1-alpha.16

7 years ago

0.0.1-alpha.15

7 years ago

0.0.1-alpha.14

7 years ago

0.0.1-alpha.13

7 years ago

0.0.1-alpha.12

7 years ago

0.0.1-alpha.10

7 years ago

0.0.1-alpha.9

7 years ago

0.0.1-alpha.8

7 years ago

0.0.1-alpha.7

7 years ago

0.0.1-alpha.6

7 years ago

0.0.1-alpha.5

7 years ago

0.0.1-alpha.4

7 years ago

0.0.1-alpha.3

7 years ago

0.0.1-alpha.2

7 years ago

0.0.1-alpha.1

7 years ago