filterSections
过滤Vue文件的sections,根据include和exclude选项筛选要处理的sections。
函数签名
typescript
function filterSections(
sections: VueSection[],
options?: VueProcessingOptions
): VueSection[]
interface VueProcessingOptions {
includeSections?: VueSectionType[]
excludeSections?: VueSectionType[]
}参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
sections | VueSection[] | 是 | Vue文件的sections数组 |
options.includeSections | VueSectionType[] | 否 | 要包含的sections |
options.excludeSections | VueSectionType[] | 否 | 要排除的sections |
返回值
| 类型 | 说明 |
|---|---|
VueSection[] | 过滤后的sections数组 |
工作原理
- 如果指定了
includeSections,只返回包含的sections - 如果指定了
excludeSections,排除指定的sections - 如果两者都指定,先应用include,再应用exclude
- 返回过滤后的sections数组
用于控制从Vue文件的哪些部分提取颜色或进行其他处理。