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 🙏

© 2025 – Pkg Stats / Ryan Hefner

kt-manage-components

v1.0.2

Published

Shared Vue 3 + Ant Design Vue components for KT projects

Readme

KT 管理组件库

简化版的 Vue 3 + Ant Design Vue 组件库,用于 KT 项目间的组件共享。

🚀 安装

# 开发阶段使用 yarn link
yarn link "kt-manage-components"

# 生产环境安装
npm install kt-manage-components-1.0.0.tgz

📦 使用方法

导入组件

// 推荐:从 components 子路径导入
import { KtStudy, KtModal, useModal } from 'kt-manage-components/components'

// 或者从主入口导入
import { KtStudy, KtModal } from 'kt-manage-components'

导入样式

// 在 main.ts 或入口文件中导入样式
import 'kt-manage-components/style.css'

完整示例

<template>
  <KtStudy 
    title="Vue 3 进阶学习"
    description="深入学习 Vue 3 核心概念"
    :progress="75"
    :duration="120"
    action-text="开始学习"
    @action="handleStart"
    @view="handleView"
    @edit="handleEdit"
    @delete="handleDelete"
  />
</template>

<script setup lang="ts">
import { KtStudy } from 'kt-manage-components/components'
import type { KtStudyProps } from 'kt-manage-components/components'

const handleStart = () => {
  console.log('开始学习')
}

const handleView = () => {
  console.log('查看详情')
}

const handleEdit = () => {
  console.log('编辑')
}

const handleDelete = () => {
  console.log('删除')
}
</script>

🧩 组件列表

KtStudy - 学习项目组件

<KtStudy 
  title="Vue 3 学习"
  :progress="75"
  @action="handleStart"
/>

Modal 系列 - 模态框组件

推荐使用模式:创建独立的业务Modal组件

<!-- 1. 创建业务Modal组件 -->
<template>
  <KtModalBase
    ref="modalRef"
    title="编辑用户"
    @ok="handleSubmit"
  >
    <!-- 你的业务逻辑 -->
    <a-form :model="formData">
      <a-form-item label="用户名">
        <a-input v-model:value="formData.username" />
      </a-form-item>
    </a-form>
  </KtModalBase>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { KtModalBase } from 'kt-manage-components/components'

const modalRef = ref()

// 关键:暴露 open 方法
defineExpose({
  open: (userId?: number) => {
    modalRef.value.open()
    if (userId) {
      // 加载数据逻辑
      modalRef.value.setLoading(true, '加载中...')
      // await fetchData(userId)
      modalRef.value.setLoading(false)
    }
  }
})
</script>

<!-- 2. 在页面中使用 -->
<template>
  <div>
    <a-button @click="userModalRef.open(123)">编辑用户</a-button>
    
    <!-- 页面保持简洁,只有一行Modal引用 -->
    <UserEditModal ref="userModalRef" @success="handleSuccess" />
  </div>
</template>

优势:

  • 页面简洁 - 避免页面中大量Modal标签
  • 组件复用 - 业务Modal可在多个页面使用
  • 逻辑集中 - Modal相关逻辑封装在组件内
  • 接口统一 - 统一的 open(id, data) 调用方式
  • 支持接口调用 - 内置加载状态管理

🔧 开发

# 安装依赖
npm install

# 启动开发服务器
npm run dev

# 构建
npm run build

# 类型检查
npm run type-check

📝 添加新组件

  1. src/components/ 中创建新组件
  2. src/components/index.ts 中导出组件
  3. 运行 npm run build 构建
  4. 在目标项目中使用:
import { YourNewComponent } from 'kt-manage-components/components'

🎯 项目结构

kt-manage-components/
├── src/
│   ├── components/           # 组件目录
│   │   ├── KtStudy.vue      # 示例组件
│   │   └── index.ts         # 组件导出
│   ├── types/               # 类型定义
│   ├── dev/                 # 开发预览
│   └── index.ts             # 主入口
├── components.ts            # 组件入口
├── dist/                    # 构建产物
└── README.md

📄 许可证

MIT License