安装
版本
leisure-lib 目前还处于丰富和迭代阶段
使用包管理器
我们建议您使用包管理器(如 NPM、Yarn 或 pnpm)安装 leisure-lib,然后您就可以使用打包工具,例如 Vite ;
整包安装
会安装 lib 库下所有的子包
sh
# NPM
npm install leisure-lib
# Yarn
yarn add leisure-lib
# Pnpm
pnpm add leisure-lib全局使用
如果不关注项目打包后的体积,建议全局引入会获得更好的开发体验
ts
import { createApp } from "vue";
import App from "./App.vue";
import LeisureLib from "leisure-lib";
const app = createApp(App);
app.use(LeisureLib).mount("#app");分包安装
如果你只是想使用某个组件或者方法可以单独安装某个子包
sh
# NPM
npm install @leisure-lib/ui
npm install @leisure-lib/utils
# Yarn
yarn add @leisure-lib/ui
yarn add @leisure-lib/utils
# Pnpm
pnpm add @leisure-lib/ui
pnpm add @leisure-lib/utils分包使用
如果不关注项目打包后的体积,建议全局引入会获得更好的开发体验
vue
<template>
<div>
<Button type="primary" @click="handleLoading"> loading </Button>
</div>
</template>
<script setup lang="ts">
import { Button, Loading } from "@leisure-lib/ui";
const handleLoading = () => {
const loading = Loading.show();
setTimeout(() => {
loading.close();
}, 2000);
};
</script>
<style scoped></style>浏览器直接引入
目前 unpkg 模式引入还在开发中