# @chenhaonan22/chn-ui

> A Vue 3 Component Library

Latest version **1.0.7** (published 2023-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chenhaonan22/chn-ui
pnpm add @chenhaonan22/chn-ui
yarn add @chenhaonan22/chn-ui
bun add @chenhaonan22/chn-ui
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-01-15 |
| First published | 2023-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | chn |
| Maintainers | chenhaonan22 |
| Keywords | @chn/chn-ui, component library, ui framework, ui, vue |

## Links

- npm: https://www.npmjs.com/package/@chenhaonan22/chn-ui
- Repository: https://github.com/nickyoung22/chn-ui
- Issues: https://github.com/nickyoung22/chn-ui/issues
- npm.io page: https://npm.io/package/@chenhaonan22/chn-ui

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2023-01-15
- 1.0.6 — 2023-01-15
- 1.0.5 — 2023-01-15
- 1.0.4 — 2023-01-15
- 1.0.3 — 2023-01-14

## README

# chn-ui

一个`vue3`组件库

---

## 安装

```shell
npm install -D @chenhaonan22/chn-ui
```

## 使用方式

### 自动引入（推荐）

安装 `unplugin-vue-components` 插件 ( https://github.com/antfu/unplugin-vue-components )

```shell
npm install -D unplugin-vue-components
```

需要`less`支持

```shell
npm install -D less
```

在`vite.config.js`中

```js
import Components from 'unplugin-vue-components/vite'
import { ChnUiResolver } from './node_modules/@chenhaonan22/chn-ui/components/resolver.js'
// import { ChnUiResolver } from '@chenhaonan22/chn-ui'

export default defineConfig({
  plugins: [
    vue(),
    Components({
      dts: true, // 会自动生成 配置文件 components.d.ts ，指明自动导入的组件

      // 指定被自动导入的组件位置,默认是 dirs: ['src/components'],
      // 默认的配置，会使得自己的组件也被自动引入，而我们只想自动引入第三方组件库的组件
      dirs: [],
      resolvers: [ChnUiResolver()]
    })
  ]
})
```

在组件内可以直接使用组件，不需要手动引入

```vue
<template>
  <!-- PascalCase 格式 -->
  <ChnHelloWord></ChnHelloWord>

  <!-- kebab-case 格式 -->
  <chn-hello-word></chn-hello-word>
</template>
```

### 手动按需引入

需要`less`支持

```shell
npm install -D less
```

在组件内

```vue
<script setup>
  // 按需引入
  import { ChnHelloWord } from '@chenhaonan22/chn-ui'
</script>

<template>
  <!-- PascalCase 格式 -->
  <ChnHelloWord></ChnHelloWord>

  <!-- kebab-case 格式 -->
  <chn-hello-word></chn-hello-word>
</template>
```

> 支持 `tree-shaking` ，在`vite`中， 如果引入了，但未使用，则不会被打包。

### 全局全部引入

需要`less`支持

```shell
npm install -D less
```

在`main.js`中

```js
import { createApp } from 'vue'
const app = createApp(App)

// 全局引入 chn-ui 组件库
import chnui from '@chenhaonan22/chn-ui'
app.use(chnui)
```

于是可以在任意组件中

```vue
<template>
  <ChnHelloWord></ChnHelloWord>
</template>
```

---
_Source: https://npm.io/package/@chenhaonan22/chn-ui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
