# fu-custom 自定义导航栏
自定义导航栏,以便于达到项目需求。组件只提供容器,内部内容由用户自定义
# 平台差异
App | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 头条小程序 |
---|---|---|---|---|---|
√ | √ | √ | √ | √ | √ |
# 基本使用
导航栏的内容通过
slot
传入,由用户自定义通过传入不同的
slot
值,对导航左中右进行自定义
<template>
<view>
<fu-custom>
<block slot="content">首页</block>
</fu-custom>
</view>
</template>
1
2
3
4
5
6
7
2
3
4
5
6
7
# 设置返回键
- 可以通过
isBack
设置返回键,通过slot="backText"
设置返回键后文字
<template>
<view>
<!-- 带返回箭头 -->
<fu-custom :isBack="true">
<block slot="content">首页</block>
<block slot="backText">返回</block>
</fu-custom>
<!-- 不带返回箭头 -->
<fu-custom :isBackText="true">
<block slot="content">首页</block>
<block slot="backText">定位</block>
</fu-custom>
</view>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# 设置右侧文字
- 可以给
slot="right"
设置侧文字
<template>
<view>
<fu-custom>
<block slot="content">购物车</block>
<block slot="right">编辑</block>
</fu-custom>
</view>
</template>
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# API
# Props
参数 | 说明 | 类型 | 默认值 | 可选值 |
---|---|---|---|---|
isBack | 是否显示返回箭头和左边文字 | Boolean String | false | true/false |
name | 插槽 | String | backText/content/right | |
bgColor | 作用在 cu-bar 上的类 | String | ||
isBackText | 开启显示左边的文字 | Boolean | false | true/false |
isFixed | 是否设置导航高度为 0 | Boolean | false | true/false |
bgImage | 导航背景图片 | String |