leafer-draw
在 Web 环境中运行。
相对 leafer-ui,减少了 App 、查找元素、事件交互等功能,适用于纯绘图场景。
安装
sh
npm install leafer-draw
sh
pnpm add leafer-draw
sh
yarn add leafer-draw
sh
bun add leafer-draw
同时我们提供了 Playground 环境 和 create-leafer 命令行工具,方便大家直接体验官网示例。
通过 script 标签引入
html
<script src="https://unpkg.com/leafer-draw@1.0.5/dist/web.min.js"></script>
<script>
const { Leafer } = LeaferUI
// ...
</script>
html
<script src="https://unpkg.com/leafer-draw@1.0.5/dist/web.js"></script>
<script>
const { Leafer } = LeaferUI
// ...
</script>
html
<script type="module">
import { Leafer } from 'https://unpkg.com/leafer-draw@1.0.5/dist/web.module.min.js'
// ...
</script>
html
<script type="module">
import { Leafer } from 'https://unpkg.com/leafer-draw@1.0.5/dist/web.module.js'
// ...
</script>
https://unpkg.com 无法访问时,可替换为 https://cdn.jsdelivr.net/npm
使用
使用方式、全局变量和 leafer-ui 一致, 只需改下包名,即可运行官网示例代码。