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 🙏

© 2024 – Pkg Stats / Ryan Hefner

taro-navbar

v1.0.3

Published

taro组件封装的自定义导航栏 可自定义返回事件 支持异形屏 支持滚动渐变

Downloads

4

Readme

taro组件 -- 自定义导航栏

  • 支持自定义返回事件
  • 兼容手机异形屏
  • 支持滚动渐隐

使用方式

npm i taro-navbar --save
import NavBar from 'taro-navbar';
import Taro, { Component } from '@tarojs/taro';
import { View, Text, Button } from '@tarojs/components';
import NavBar from 'taro-navbar';
import './index.scss'




export default class Index extends Component {

    config = {
        navigationBarTitleText: '',
        navigationStyle: 'custom'
    }

    state = {
       
    }

    componentWillMount() { }
    componentDidMount() { }
    componentWillReceiveProps(nextProps, nextContext) { }
    componentWillUnmount() { }
    componentDidShow() { }
    componentDidHide() { }
    componentDidCatchError() { }
    componentDidNotFound() { }
    handlerGobackClick(e) {
        Taro.showModal({
            title: '你点击了返回',
            content: '是否确认放回',
            success: (e) => {
                if (e.confirm) {
                    Taro.navigateBack({
                        delta: 1
                    });
                }
            }
        })
    }
    render() {
        return (
            <View>
                <NavBar title='默认置顶导航' protectInaver onGoBackClick={this.handlerGobackClick.bind(this)} toBack={false} ></NavBar>
                <View className='ex-value'>
                    {` <NavBar title='默认置顶导航' protectInaver onGoBackClick={this.handlerGobackClick.bind(this)} toBack={false} ></NavBar>`}
                </View>
                <View className='content'>
                    <Text>
                        可能我们会需要使用沉浸式设计的时候使用到 "navigationStyle": "custom" 属性
                        这个时候小程序提供的标题栏就会失效,
                        这时候自己去定义一个标题栏就很重要的
                        该自定义组件提供和微信相同样式的标题栏
                        并且这里对返回按钮的点击事件除了可以使用默认的返回按钮之外 还提供了返回事件 自己处理返回跳转的页面
                    </Text>
                </View>
                <NavBar title='不显示返回按钮' showBack={false} fixedtop={false} ></NavBar>
                <View className='ex-value'>
                        {`<NavBar title='不显示返回按钮' showBack={false} fixedtop={false} ></NavBar>`}
                </View>
                <NavBar title='白色主题标题栏' colorTheme='black' background='#ffffff' fixedtop={false} ></NavBar>
                <View className='ex-value'>
                      {` <NavBar title='白色主题标题栏' colorTheme='black' background='#ffffff' fixedtop={false} ></NavBar>`}
                </View> 
                <NavBar title='黑色主题标题栏' colorTheme='white' background='#000' fixedtop={false} ></NavBar>
                <View className='ex-value'>
                    {`
                            <NavBar title='黑色主题标题栏' colorTheme='white' background='#000' fixedtop={false} ></NavBar>
                    `}
                </View> 

            </View>
        );
    }
}

实际使用例子

https://github.com/moyuanhua/taro-navbar