Skip to main content

focusDefaultPropsPath()v4.0.165

滚动到默认属性编辑器中的特定字段。

示例

对于以下 Zod 模式:

schema.ts
tsx
import { z } from "zod";
 
const MySchema = z.object({
array: z.array(
z.object({
subfield: z.string(),
}),
),
});
schema.ts
tsx
import { z } from "zod";
 
const MySchema = z.object({
array: z.array(
z.object({
subfield: z.string(),
}),
),
});

调用 focusDefaultPropsPath() 并提供要关注的字段的路径:

MyComp.tsx
tsx
import { focusDefaultPropsPath } from "@remotion/studio";
 
focusDefaultPropsPath({
path: ["array", 0, "subfield"],
});
MyComp.tsx
tsx
import { focusDefaultPropsPath } from "@remotion/studio";
 
focusDefaultPropsPath({
path: ["array", 0, "subfield"],
});

API

path

要关注的字段的路径。包含数字和字符串的数组。

scrollBehavior

滚动行为。
其中之一为 "auto" | "instant" | "smooth"
默认为默认滚动行为

参见