The test students reported that a function in the production environment was abnormal, and then sent me a screenshot of the error report.
The reasons for this are as follows:
The issue title is straightforward, and Event.path will be deleted. As can be seen from the content of the issue, this incident started on December 7, 2021. The reason is that the chromium development team believes that Event.path is a non-standard API, which will cause compatibility issues with other browsers such as Firefox, so they decided to delete it. At present, this change is in the grayscale stage in chrome 108, and it will be fully applied in the upcoming chrome 109, and webview will be gradually disabled starting from version 109
Solution:
add in app.vue page mounted lifecycle
// 处理e.path 报错的问题
this.$nextTick(() => {
Object.defineProperty(Event.prototype, "path", {
get() {
return this.composedPath();
}
});
});
It can perfectly solve the error reporting problem caused by Event.path, and the personal test is effective. . .