预期的图片选项。
ExpectedImageOptions:预期 getImage() 参数是一个对象。收到
OPTIONS
。¥ExpectedImageOptions: Expected getImage() parameter to be an object. Received
OPTIONS
.
什么地方出了错?
标题部分 什么地方出了错?¥What went wrong?
getImage()
的第一个参数应该是一个具有不同属性的对象,以应用于你的图片。
¥getImage()
’s first parameter should be an object with the different properties to apply to your image.
import { getImage } from "astro:assets";import myImage from "../assets/my_image.png";
const optimizedImage = await getImage({src: myImage, width: 300, height: 300});
在大多数情况下,发生此错误是因为参数是直接传递的,而不是在对象内部传递的。
¥In most cases, this error happens because parameters were passed directly instead of inside an object.
也可以看看:
¥See Also:
Error Reference