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

th-vue-component

v2.1.6

Published

th-vue-component

Readme

基于element-ui封装的公共组件库

文档 DEMO

  • 本库主要包含基础组件、工具类、主题样式

npm i element-ui -S npm i th-vue-component -S

全局导入(方式一)

  import ThVueComponent from 'th-vue-component'
  import 'th-vue-component/lib/theme/index.css'
  import 'th-vue-component/lib/th-vue-component.css'
  Vue.use(ThVueComponent)
  • 配置
module.exports = {
  chainWebpack: config => {
    // 别名
    config.resolve.alias
      .set('@@', resolve('node_modules/th-vue-component/src'))
      .set('variable', resolve('node_modules/th-vue-component/src/assets/theme/src/common/variable.scss'))
  },
  transpileDependencies: [
    'th-vue-component/src'
  ]
}

html中引入资源(方式二)

CDN项目

<head>
  <link type="text/css" rel="stylesheet" href="http://localhost:5500/cdn/js/th-vue-component/2.0.21/th-vue-component.css">
  <link type="text/css" rel="stylesheet" href="http://localhost:5500/cdn/js/th-vue-component/2.0.21/theme/index.css">
  <script src="http://localhost:5500/cdn/js/vue/2.6.11/vue.min.js" type="text/javascript"></script>
  <script src="http://localhost:5500/cdn/js/element-ui/2.13.2/lib/index.js" type="text/javascript"></script>
  <script src="http://localhost:5500/cdn/js/th-vue-component/2.0.21/th-vue-component.umd.js" type="text/javascript"></script>
  <script src="http://localhost:5500/cdn/js/xlsx-style/0.8.13/xlsx.full.min.js" type="text/javascript" async=""></script>
  <script src="http://localhost:5500/cdn/js/xlsx/0.15.6/xlsx.full.min.js" type="text/javascript" async=""></script>
  • 配置
module.exports = {
  chainWebpack: config => {
    // 别名
    config.resolve.alias
      .set('@@', resolve('node_modules/th-vue-component/src'))
      .set('variable', resolve('node_modules/th-vue-component/src/assets/theme/src/common/variable.scss'))
    // 排除打包
    if (process.env.NODE_ENV === 'production') {
      config.externals({
        'th-vue-component': 'th-vue-component'
      })
    }
  },
  transpileDependencies: [
    'th-vue-component/src'
  ]
}

指令说明

# 安装依赖
npm run pre

# 启动DEMO开发模式
npm run dev

# 打包组件
npm run build

# 打包样式
npm run build:theme

# 发布(npm adduser && npm login)
npm run deploy

基础组件

  • 表格: <th-table></th-table>
  • 分页: <th-pagination></th-pagination>
  • 表单: <th-form></th-form>
  • 表单标题: <th-form-title></th-form-title>
  • 搜索套件: <th-search></th-search>
  • 标签页: <th-tabs></th-tabs>
  • 下拉选择: <th-select></th-select>
  • 下拉菜单: <th-dropdown></th-dropdown>
  • 导出表格: <th-export-excel></th-export-excel>
  • 导入表格: <th-import-excel></th-import-excel>
  • 文件上传: <th-file-upload></th-file-upload>
  • 图标: <th-icon></th-icon>
  • 链接: <th-link></th-link>
  • 气泡: <th-popover></th-popover>
  • 提示: <th-tooltip></th-tooltip>
  • 标签输入框: <th-textarea-tags></th-textarea-tags>
  • 树型输入框: <th-input-tree></th-input-tree>
  • 时间线: <th-timeline></th-timeline>
  • 图片预览: <th-viewer></th-viewer>
  • 主题切换: <th-theme></th-theme>
  • 403: <th-error-403></th-error-403>
  • 404: <th-error-404></th-error-404>
  • 500: <th-error-500></th-error-500>

th-export-excel导出组件需要将node_modules/th-vue-component/public/cdn/xlsx复制到项目的public/cdn/目录下

自动注册属性

校验匹配规则

  • this.$validate

Form表单校验规则

  • this.$rules

日期时间插件

  • this.$moment

数组类型及长度判断

  • this.$length

序列化

  • this.$util.serialize

对象深拷贝

  • this.$util.deepClone

文件下载 by Blob文件流

  • this.$util.download

文件下载 by 网络地址

  • this.$util.downloadByUrl

内容复制

  • this.$util.copy

本地存储

  • this.$localStore

公共样式、主题样式切换

公共样式

  • src/assets/index.scss

扩展el-icon

  • src/assets/font/iconfont.css

自定义element-ui主题

  • src/assets/theme/src/index.scss

主题样式变量

  • src/assets/theme/src/common/variable.scss

主题定义和切换

  • src/mixins/color.js