Skip to content

Flow 自动布局

类似 Flex 的自动布局,更简单、直观,可以快速自动排版内容。

注意事项

需安装 自动布局插件 才能使用。

ts
import { Leafer, Rect } from 'leafer-ui'
import { Flow } from '@leafer-in/flow'

const leafer = new Leafer({ view: window })

const red = new Rect({ fill: '#FF4B4B', width: 20, height: 20 })
const yellow = new Rect({ fill: '#FEB027', width: 20, height: 40 })
const green = new Rect({ fill: '#79CB4D', width: 20, height: 30 })

const flow = new Flow({ children: [red, yellow, green], fill: '#676', width: 100, height: 100 }) 

leafer.add(flow)

下一步

交互状态

Released under the MIT License.