OneScript

clipped

将绘制内容裁切到视图 frame。

frame() 保留 SwiftUI 的越界绘制行为。在它后面添加 clipped(),即可将绘制内容裁切到 frame 边界。

import { Image, Modifier } from "onescript/views"

const photoURL = new URL("https://example.com/photo.png")

<Image
  url={photoURL}
  resizable
  modifier={Modifier
    .scaledToFill()
    .frame({ width: 160, height: 90 })
    .clipped()}
/>

How is this guide?

最后更新于