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/tag

v1.0.1

Published

### 引入

Downloads

2

Readme

Tag 标签

引入

import Vue from 'vue';
import Tag from '@ophiuchus/tag';

Vue.use(Tag);

代码演示

基础用法

通过 type 属性控制标签颜色。

<sf-tag type="primary">标签</sf-tag>
<sf-tag type="success">标签</sf-tag>
<sf-tag type="danger">标签</sf-tag>
<sf-tag type="warning">标签</sf-tag>

空心样式

设置 plain 属性设置为空心样式。

<sf-tag plain type="primary">标签</sf-tag>

圆角样式

通过 round 设置为圆角样式。

<sf-tag round type="primary">标签</sf-tag>

标记样式

通过 mark 设置为标记样式(半圆角)。

<sf-tag mark type="primary">标签</sf-tag>

可关闭标签

添加 closeable 属性表示标签是可关闭的,关闭标签时会触发 close 事件,在 close 事件中可以执行隐藏标签的逻辑。

<sf-tag v-if="show" closeable size="medium" type="primary" @close="close">
  标签
</sf-tag>
export default {
  data() {
    return {
      show: true,
    };
  },
  methods: {
    close() {
      this.show = false;
    },
  },
};

标签大小

通过 size 属性调整标签大小。

<sf-tag type="primary">标签</sf-tag>
<sf-tag type="primary" size="medium">标签</sf-tag>
<sf-tag type="primary" size="large">标签</sf-tag>

自定义颜色

通过 colortext-color 属性设置标签颜色。

<sf-tag color="#7232dd">标签</sf-tag>
<sf-tag color="#ffe1e1" text-color="#ad0000">标签</sf-tag>
<sf-tag color="#7232dd" plain>标签</sf-tag>

API

Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | type | 类型,可选值为primary success danger warning | string | default | | size | 大小, 可选值为large medium | string | - | | color | 标签颜色 | string | - | | plain | 是否为空心样式 | boolean | false | | round | 是否为圆角样式 | boolean | false | | mark | 是否为标记样式 | boolean | false | | text-color | 文本颜色,优先级高于color属性 | string | white | | closeable | 是否为可关闭标签 | boolean | false |

Slots

| 名称 | 说明 | | ------- | ------------ | | default | 标签显示内容 |

Events

| 事件名 | 说明 | 回调参数 | | ------ | -------------- | -------------- | | click | 点击时触发 | event: Event | | close | 关闭标签时触发 | - |

样式变量

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

| 名称 | 默认值 | 描述 | | --------------------------- | --------------------------- | ---- | | @tag-padding | 0 @padding-base | - | | @tag-text-color | @white | - | | @tag-font-size | @font-size-sm | - | | @tag-border-radius | 2px | - | | @tag-line-height | 16px | - | | @tag-medium-padding | 2px 6px | - | | @tag-large-padding | @padding-base @padding-xs | - | | @tag-large-border-radius | @border-radius-md | - | | @tag-large-font-size | @font-size-md | - | | @tag-round-border-radius | @border-radius-max | - | | @tag-danger-color | @red | - | | @tag-primary-color | @blue | - | | @tag-success-color | @green | - | | @tag-warning-color | @orange | - | | @tag-default-color | @gray-6 | - | | @tag-plain-background-color | @white | - |