快速安装
安装
确保你已安装了 Node.js。
sh
npm install leafer-ui
sh
pnpm add leafer-ui
sh
yarn add leafer-ui
推荐速度更快的 pnpm。
体验
创建一个交互应用,可以缩放平移视图、拖拽矩形。
ts
import { Leafer, Rect } from 'leafer-ui'
const leafer = new Leafer({ view: window })
const rect = new Rect({
x: 100,
y: 100,
width: 200,
height: 200,
fill: '#32cd79',
draggable: true
})
leafer.add(rect)
html
<!DOCTYPE html>
<html>
<head>
<title>Demo | Leafer UI</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="https://unpkg.com/leafer-ui@1.0.0-alpha.22/index.min.js"></script>
</head>
<body>
</body>
<script>
var leafer = new LeaferUI.Leafer({ view: window })
var rect = new LeaferUI.Rect({
x: 100,
y: 100,
width: 200,
height: 200,
fill: '#32cd79',
draggable: true
})
leafer.add(rect)
</script>
</html>