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/bottom-action

v1.0.2

Published

### 引入

Downloads

1

Readme

BottomAction 底部操作按钮

引入

// 方式1(推荐)
import Vue from 'vue';
import BottomAction from '@ophiuchus/bottom-action';

Vue.use(BottomAction);

// 方式2
import Vue from 'vue';
import { BottomAction, BottomActionIcon, BottomActionButton } from '@ophiuchus/bottom-action';

Vue.component(BottomAction.name, BottomAction);
Vue.component(BottomActionIcon.name, BottomActionIcon);
Vue.component(BottomActionButton.name, BottomActionButton);

代码演示

基础用法

<sf-bottom-action>
  <sf-bottom-action-icon icon="good-job-o" text="点赞" @click="onClickIcon" />
  <sf-bottom-action-icon icon="star-o" text="收藏" @click="onClickIcon" />
  <sf-bottom-action-button type="warning" text="上一篇" @click="onClickButton" />
  <sf-bottom-action-button type="danger" text="下一篇" @click="onClickButton" />
  <sf-bottom-action-icon icon="ellipsis" text="更多" @click="onClickIcon" />
</sf-bottom-action>
import Toast from '@ophiuchus/toast';

export default {
  methods: {
    onClickIcon() {
      Toast('点击图标');
    },
    onClickButton() {
      Toast('点击按钮');
    },
  },
};

徽标提示

在 BottomActionIcon 组件上设置 dot 属性后,会在图标右上角展示一个小红点。设置 badge 属性后,会在图标右上角展示相应的徽标。

<sf-bottom-action>
  <sf-bottom-action-icon icon="good-job-o" dot text="点赞" />
  <sf-bottom-action-icon icon="star-o" badge="5" text="收藏" />
  <sf-bottom-action-icon icon="ellipsis" badge="12" text="更多" />
  <sf-bottom-action-button type="warning" text="上一篇" />
  <sf-bottom-action-button type="danger" text="下一篇" />
</sf-bottom-action>

自定义图标颜色

通过 BottomActionIcon 的 color 属性可以自定义图标的颜色。

<sf-bottom-action>
  <sf-bottom-action-icon icon="good-job" text="已赞" color="#ee0a24" />
  <sf-bottom-action-icon icon="star" text="已收藏" color="#ff5000" />
  <sf-bottom-action-icon icon="ellipsis" text="更多" />
  <sf-bottom-action-button type="warning" text="上一篇" />
  <sf-bottom-action-button type="danger" text="下一篇" />
</sf-bottom-action>

自定义按钮颜色

通过 BottomActionButton 的 color 属性可以自定义按钮的颜色,支持传入 linear-gradient 渐变色。

<sf-bottom-action>
  <sf-bottom-action-icon icon="good-job-o" text="点赞" />
  <sf-bottom-action-icon icon="star-o" text="收藏" />
  <sf-bottom-action-button color="#be99ff" type="warning" text="上一篇" />
  <sf-bottom-action-button color="#7232dd" type="danger" text="下一篇" />
</sf-bottom-action>

单个按钮

也支持底部只有单个按钮的情况。

<sf-bottom-action>
  <sf-bottom-action-button type="primary" text="提交" />
</sf-bottom-action>

API

BottomAction Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | safe-area-inset-bottom | 是否开启底部安全区适配 | boolean | true |

BottomActionIcon Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | text | 按钮文字 | string | - | | icon | 图标 | string | - | | color | 图标颜色 | string | #323233 | | icon-class | 图标额外类名 | any | - | | dot | 是否显示图标右上角小红点 | boolean | false | | badge | 图标右上角徽标的内容 | number | string | - | | info | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | number | string | - | | url | 点击后跳转的链接地址 | string | - | | to | 点击后跳转的目标路由对象,同 vue-router 的 to 属性 | string | object | - | | replace | 是否在跳转时替换当前页面历史 | boolean | false |

BottomActionButton Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | text | 按钮文字 | string | - | | type | 按钮类型,可选值为 primary info warning danger | string | default | | color | 按钮颜色,支持传入linear-gradient渐变色 | string | - | | icon | 左侧图标名称或图片链接 | string | - | | disabled | 是否禁用按钮 | boolean | false | - | | loading | 是否显示为加载状态 | boolean | false | - | | url | 点击后跳转的链接地址 | string | - | | to | 点击后跳转的目标路由对象,同 vue-router 的 to 属性 | string | object | - | | replace | 是否在跳转时替换当前页面历史 | boolean | false |

BottomActionIcon Slots

| 名称 | 说明 | | ------- | ---------- | | default | 文本内容 | | icon | 自定义图标 |

BottomActionButton Slots

| 名称 | 说明 | | ------- | ------------ | | default | 按钮显示内容 |

样式变量

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

| 名称 | 默认值 | 描述 | | ---------------------------------- | ------------------ | ---- | | @bottom-action-background-color | @white | - | | @bottom-action-height | 50px | - | | @bottom-action-icon-width | 48px | - | | @bottom-action-icon-height | 100% | - | | @bottom-action-icon-color | @text-color | - | | @bottom-action-icon-size | 18px | - | | @bottom-action-icon-font-size | @font-size-xs | - | | @bottom-action-icon-active-color | @active-color | - | | @bottom-action-icon-text-color | @gray-7 | - | | @bottom-action-button-height | 40px | - | | @bottom-action-button-warning-color | @gradient-orange | - | | @bottom-action-button-danger-color | @gradient-red | - |