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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vsoft-ui

v1.0.11

Published

基于Element Plus的二次封装组件库,包含全局权限控制功能

Readme

VSoft UI

基于 Element Plus 的二次封装组件库,包含全局权限控制功能。

安装

npm install vsoft-ui element-plus @element-plus/icons-vue

使用

注册组件库

// main.ts
import { createApp } from 'vue'
import App from './App.vue'
import VSoftUI from 'vsoft-ui'

const app = createApp(App)

// 安装组件库(自动导入 Element Plus 及其样式)
app.use(VSoftUI)

app.mount('#app')

2. 权限控制配置

// 在适当的位置设置权限
import { usePermission } from 'vsoft-ui'

const { setPermissions } = usePermission()
setPermissions(['user:view', 'user:edit', 'button:click'])

组件使用

所有组件均以 V 开头,保持与 Element Plus API 一致:

<template>
  <!-- 权限控制指令 -->
  <v-button v-permission="'user:view'" type="primary">查看</v-button>
  <v-button v-permission="'user:edit'" type="success">编辑</v-button>
  
  <!-- 普通组件 -->
  <v-form>
    <v-form-item label="用户名" prop="username">
      <v-input v-model="form.username" placeholder="请输入用户名"></v-input>
    </v-form-item>
  </v-form>
</template>

<script setup>
import { ref, reactive } from 'vue'

const form = reactive({
  username: ''
})
</script>

权限控制

指令方式

<!-- 单个权限 -->
<v-button v-permission="'user:view'">查看</v-button>

<!-- any 模式 - 满足任一权限 -->
<v-button v-permission:any="['user:view', 'user:edit']">编辑</v-button>

<!-- all 模式 - 满足所有权限 -->
<v-button v-permission:all="['user:view', 'user:admin']">管理</v-button>

组合式函数

<template>
  <v-button @click="checkPermission">检查权限</v-button>
</template>

<script setup>
import { usePermission } from 'vsoft-ui'

const { hasPermission, hasAllPermissions } = usePermission()

const checkPermission = () => {
  const canView = hasPermission('user:view')
  const canAdmin = hasAllPermissions(['user:view', 'user:admin'])
  console.log(canView, canAdmin)
}
</script>

组件列表

  • VAffix
  • VAlert
  • VAside
  • VAvatar
  • VBacktop
  • VBadge
  • VBreadcrumb
  • VBreadcrumbItem
  • VButton
  • VCalendar
  • VCard
  • VCarousel
  • VCarouselItem
  • VCascader
  • VCheckbox
  • VCheckboxButton
  • VCollapse
  • VCollapseItem
  • VColorPicker
  • VConfigProvider
  • VContainer
  • VDatePicker
  • VDialog
  • VDivider
  • VDrawer
  • VDropdown
  • VDropdownItem
  • VDropdownMenu
  • VEmpty
  • VFooter
  • VForm
  • VFormItem
  • VHeader
  • VIcon
  • VImage
  • VInput
  • VInputNumber
  • VLink
  • VMain
  • VMenu
  • VMenuGroup
  • VMenuItem
  • VOption
  • VOptionGroup
  • VPagination
  • VPopconfirm
  • VPopper
  • VProgress
  • VRadio
  • VRadioButton
  • VRate
  • VScrollbar
  • VSelect
  • VSelectV2
  • VSlider
  • VSpace
  • VStep
  • VSteps
  • VSubMenu
  • VSwitch
  • VTable
  • VTableColumn
  • VTabPane
  • VTabs
  • VTag
  • VTimeline
  • VTimelineItem
  • VTimePicker
  • VTooltip
  • VTransfer
  • VTree
  • VTreeNode
  • VUpload
  • VUploadDragger

注意事项

  1. 本组件库基于 Element Plus,使用前请确保已安装 Element Plus 和 @element-plus/icons-vue
  2. 组件库已自动导入 Element Plus 及其样式,无需手动导入
  3. 组件库已自动安装 Element Plus,无需再次单独安装
  4. 所有组件均保持与 Element Plus API 一致,使用方式相同

更新日志

  • 1.0.0: 初始版本,包含权限控制和基础组件
  • 1.0.4: 优化打包配置,修复样式问题

许可证

MIT