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

@ophiuchus/notice-bar

v1.0.1

Published

### 介绍

Downloads

2

Readme

NoticeBar 通知栏

介绍

用于循环播放展示一组消息通知。

引入

import Vue from 'vue';
import NoticeBar from '@ophiuchus/notice-bar';

Vue.use(NoticeBar);

代码演示

基础用法

通过 text 属性设置通知栏的内容,通过 left-icon 属性设置通知栏左侧的图标。

<sf-notice-bar
  left-icon="volume-o"
  text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。"
/>

滚动播放

通知栏的内容长度溢出时会自动开启滚动播放,通过 scrollable 属性可以控制该行为。

<!-- 文字较短时,通过设置 scrollable 属性开启滚动播放 -->
<sf-notice-bar scrollable text="技术是开发它的人的共同灵魂。" />

<!-- 文字较长时,通过禁用 scrollable 属性关闭滚动播放 -->
<sf-notice-bar
  :scrollable="false"
  text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。"
/>

多行展示

文字较长时,可以通过设置 wrapable 属性来开启多行展示。

<sf-notice-bar
  wrapable
  :scrollable="false"
  text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。"
/>

通知栏模式

通知栏支持 closeablelink 两种模式。

<!-- closeable 模式,在右侧显示关闭按钮 -->
<sf-notice-bar mode="closeable">技术是开发它的人的共同灵魂。</sf-notice-bar>

<!-- link 模式,在右侧显示链接箭头 -->
<sf-notice-bar mode="link">技术是开发它的人的共同灵魂。</sf-notice-bar>

自定义样式

通过 color 属性设置文本颜色,通过 background 属性设置背景色。

<sf-notice-bar color="#1989fa" background="#ecf9ff" left-icon="info-o">
  技术是开发它的人的共同灵魂。
</sf-notice-bar>

垂直滚动

搭配 NoticeBar 和 Swipe 组件可以实现垂直滚动的效果。

<sf-notice-bar left-icon="volume-o" :scrollable="false">
  <sf-swipe
    vertical
    class="notice-swipe"
    :autoplay="3000"
    :show-indicators="false"
  >
    <sf-swipe-item>内容 1</sf-swipe-item>
    <sf-swipe-item>内容 2</sf-swipe-item>
    <sf-swipe-item>内容 3</sf-swipe-item>
  </sf-swipe>
</sf-notice-bar>

<style>
  .notice-swipe {
    height: 40px;
    line-height: 40px;
  }
</style>

API

Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | mode | 通知栏模式,可选值为 closeable link | string | '' | | text | 通知文本内容 | string | '' | | color | 通知文本颜色 | string | #f60 | | background | 滚动条背景 | string | #fff7cc | | left-icon | 左侧图标名称或图片链接 | string | - | | delay | 动画延迟时间 (s) | number | string | 1 | | speed | 滚动速率 (px/s) | number | string | 60 | | scrollable | 是否开启滚动播放,内容长度溢出时默认开启 | boolean | - | | wrapable | 是否开启文本换行,只在禁用滚动时生效 | boolean | false |

Events

| 事件名 | 说明 | 回调参数 | | --------------- | ---------------------------- | -------------- | | click | 点击通知栏时触发 | event: Event | | close | 关闭通知栏时触发 | event: Event | | replay | 每当滚动栏重新开始滚动时触发 | - |

Slots

| 名称 | 内容 | | ---------- | -------------- | | default | 通知文本内容 | | left-icon | 自定义左侧图标 | | right-icon | 自定义右侧图标 |

样式变量

组件提供了下列 Less 变量,可用于自定义样式,使用方法请参考主题定制

| 名称 | 默认值 | 描述 | | ---------------------------- | ------------------------- | ---- | | @notice-bar-height | 40px | - | | @notice-bar-padding | 0 @padding-md | - | | @notice-bar-wrapable-padding | @padding-xs @padding-md | - | | @notice-bar-text-color | @orange-dark | - | | @notice-bar-font-size | @font-size-md | - | | @notice-bar-line-height | 24px | - | | @notice-bar-background-color | @orange-light | - | | @notice-bar-icon-size | 16px | - | | @notice-bar-icon-min-width | 24px | - |