# yh-ui **Repository Path**: CSfan/yh-ui ## Basic Information - **Project Name**: yh-ui - **Description**: 从零到一开发 用ts开发 vue3-ui 组件库 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: develop - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-05-26 - **Last Updated**: 2022-06-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ui-yh ui-yh ## 安装 `npm install ui-yh` ### 使用 #### 全局加载 ```ts import { createApp } from "vue"; import App from "./App.vue"; import YhUi from "ui-yh"; // 如果没有使用 less 可以直接引入 yh-ls-ui/lib/style/index.css import "ui-yh/lib/style/index.less"; createApp(App).use(YhUi).mount("#app"); ``` #### 按需加载 使用 `babel-plugin-import` 实现 `babel.config.js` ```js module.exports = { //... plugins: [ //... [ "import", { libraryName: "ui-yh", libraryDirectory: "lib", style: (name) => { // 如果没less loader 则 return `${name}/index.css`; return `${name}/index.less`; }, }, ], ], }; ``` ```ts import { createApp } from "vue"; import App from "./App.vue"; import {button} from "ui-yh"; // 基本样式没有打入组件中 需要手动引用 // 如果没有使用 less 可以直接引入 yh-ls-ui/lib/style/base.css import "ui-yh/lib/style/base.less"; createApp(App).use(button).mount("#app"); ```