Skip to content

filterSections

过滤Vue文件的sections,根据include和exclude选项筛选要处理的sections。

函数签名

typescript
function filterSections(
  sections: VueSection[],
  options?: VueProcessingOptions
): VueSection[]

interface VueProcessingOptions {
  includeSections?: VueSectionType[]
  excludeSections?: VueSectionType[]
}

参数

参数名类型必填说明
sectionsVueSection[]Vue文件的sections数组
options.includeSectionsVueSectionType[]要包含的sections
options.excludeSectionsVueSectionType[]要排除的sections

返回值

类型说明
VueSection[]过滤后的sections数组

工作原理

  1. 如果指定了 includeSections,只返回包含的sections
  2. 如果指定了 excludeSections,排除指定的sections
  3. 如果两者都指定,先应用include,再应用exclude
  4. 返回过滤后的sections数组

用于控制从Vue文件的哪些部分提取颜色或进行其他处理。