export function checkFormKeyEnter(fileContent: string, filePath: string) { let result = fileContent.match(/]*>[\s\S]*?<\/el-form>/g); if (result) { result.forEach((formTag) => { // 检查 是否含有查询按钮 const searchRegex = /]*>\s*查询[\s\S]*/.test(formTag); // 检查 是否包含 @keydown.enter 属性 const keydownVueRegex = /@keydown\.enter=/.test(formTag); const keydownTsxRegex = /onKeyDown=/.test(formTag); if (searchRegex && !(keydownVueRegex || keydownTsxRegex)) { console.warn(`Warning: ${filePath} - 表单没监听回车事件`); } }); } }