From b5b8970ab5ce4d820857a73cc482d813e58cdd6b Mon Sep 17 00:00:00 2001 From: midfar Date: Mon, 13 Mar 2023 18:11:15 +0800 Subject: [PATCH] fix error --- mock/_createProductionServer.js | 5 ----- src/views/example/components/ArticleDetail.vue | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mock/_createProductionServer.js b/mock/_createProductionServer.js index f04f634..297a57e 100644 --- a/mock/_createProductionServer.js +++ b/mock/_createProductionServer.js @@ -14,10 +14,5 @@ Object.keys(modules).forEach((key) => { * Used in a production environment. Need to manually import all modules */ export function setupProdMockServer() { - // https://kgithub.com/nuysoft/Mock/issues/301 - // 避免 _xhr.upload.addEventListener is not a function - var xhr = new window._XMLHttpRequest(); - window.XMLHttpRequest.prototype.upload = xhr.upload; - createProdMockServer(mockModules); } diff --git a/src/views/example/components/ArticleDetail.vue b/src/views/example/components/ArticleDetail.vue index 1494ee7..17b7584 100644 --- a/src/views/example/components/ArticleDetail.vue +++ b/src/views/example/components/ArticleDetail.vue @@ -177,6 +177,13 @@ export default defineComponent({ // Because if you enter this page and quickly switch tag, may be in the execution of the setTagsViewTitle function, this.$route is no longer pointing to the current page // https://github.com/PanJiaChen/vue-element-admin/issues/1221 this.tempRoute = Object.assign({}, this.$route); + + // https://kgithub.com/nuysoft/Mock/issues/301 + // 避免 _xhr.upload.addEventListener is not a function + if (window._XMLHttpRequest) { + var xhr = new window._XMLHttpRequest(); + window.XMLHttpRequest.prototype.upload = xhr.upload; + } }, methods: { fetchData(id) {