vue-error-stack-parser
v1.0.1
Published
vue 获取js错误行列号
Downloads
1
Readme
例子
import errorStackParser from 'vue-error-stack-parser'
app.config.errorHandler = (err, vm, info) => {
try {
const errorStack = errorStackParser.parse(err)
let errorRes = {}
if (errorStack && Array.isArray(errorStack) && errorStack.length) {
errorRes = errorStack[0]
}
if (errorRes.lineNumber) {
console.log({
row: errorRes.lineNumber,
column: errorRes.columnNumber,
url: errorRes.fileName
})
}
} catch (error) {}
}