This commit is contained in:
lzp
2026-02-27 14:58:36 +08:00
parent e2e1bcf322
commit 43ea391a75
10 changed files with 159 additions and 90 deletions

20
src/ignoredWarning.ts Normal file
View File

@@ -0,0 +1,20 @@
// 定义要忽略的警告关键词列表
const ignoredWarnings = [
'`markRaw` or using `shallowRef` instead of `ref`',
]
/** 忽略组件响应式警告 */
export default function (app) {
// 只忽略组件响应式警告
app.config.warnHandler = (msg, instance, trace) => {
// 检查是否包含要忽略的关键词
const shouldIgnore = ignoredWarnings.some(warning =>
msg.includes(warning)
)
// 如果不应该忽略,才输出警告
if (!shouldIgnore) {
console.warn(msg, instance, trace)
}
}
}