🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

youyu-button

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youyu-button

A custom button component for Vue 3

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

youyu-button

一个基于 Vue 3 的自定义按钮组件插件,提供丰富的样式和配置选项。

功能特性

  • 支持多种按钮类型:默认、主要、次要、成功、警告、危险、信息
  • 支持多种按钮尺寸:迷你(MINI)、小(S)、中(M)、大(L)、特大(XL)
  • 支持圆角样式
  • 支持激活和禁用状态
  • 支持自定义类名
  • 响应式设计

安装

# 使用 npm
npm install youyu-button

# 使用 yarn
yarn add youyu-button

# 使用 pnpm
pnpm add youyu-button

使用

全局安装

// main.ts
import { createApp } from "vue";
import YouyuButtonPlugin from "youyu-button";
import "youyu-button/dist/main.css";

const app = createApp(App);
app.use(YouyuButtonPlugin);
app.mount("#app");

局部使用

<script setup lang="ts">
import { YouyuButton } from "youyu-button";
import "youyu-button/dist/main.css";
</script>

<template>
  <YouyuButton type="primary">主要按钮</YouyuButton>
</template>

组件属性

属性名类型默认值说明
typestringdefault按钮类型:default, primary, secondary, success, warning, danger, info
sizestringM按钮尺寸:MINI, S, M, L, XL
roundedbooleanfalse是否显示圆角
activebooleanfalse是否激活状态
disabledbooleanfalse是否禁用状态
classNamestring自定义类名

事件

事件名说明参数
click点击事件MouseEvent

示例

基础按钮

<YouyuButton type="default">默认按钮</YouyuButton>
<YouyuButton type="primary">主要按钮</YouyuButton>
<YouyuButton type="success">成功按钮</YouyuButton>
<YouyuButton type="warning">警告按钮</YouyuButton>
<YouyuButton type="danger">危险按钮</YouyuButton>

不同尺寸

<YouyuButton type="primary" size="MINI">迷你按钮</YouyuButton>
<YouyuButton type="primary" size="S">小按钮</YouyuButton>
<YouyuButton type="primary" size="M">中按钮</YouyuButton>
<YouyuButton type="primary" size="L">大按钮</YouyuButton>
<YouyuButton type="primary" size="XL">特大按钮</YouyuButton>

圆角按钮

<YouyuButton type="primary" rounded>圆角按钮</YouyuButton>

激活和禁用状态

<YouyuButton type="primary" active>激活按钮</YouyuButton>
<YouyuButton type="primary" disabled>禁用按钮</YouyuButton>

自定义类名

<YouyuButton type="primary" className="custom-button">自定义按钮</YouyuButton>

项目开发

安装依赖

pnpm install

开发模式

pnpm dev

构建生产版本

pnpm build

许可证

MIT

Keywords

vue

FAQs

Package last updated on 21 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts