Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用Mockjs问题 #340

Open
tk103331 opened this issue Oct 11, 2019 · 5 comments
Open

使用Mockjs问题 #340

tk103331 opened this issue Oct 11, 2019 · 5 comments

Comments

@tk103331
Copy link

tk103331 commented Oct 11, 2019

项目中使用了Mockjs,组件报错,在vue-element-admin找到了解决办法。

PanJiaChen/vue-element-admin#1466

下面是我的解决办法:

Mock.XHR.prototype.proxy_open = Mock.XHR.prototype.open;
Mock.XHR.prototype.open = function() {
    let responseType = this.responseType;
    this.proxy_open(...arguments)
    if (this.custom.xhr) {
        if (responseType) {
            this.custom.xhr.responseType = responseType
        }
    }
}
@xyxiao001
Copy link
Owner

可以 方便后面的人兼容

@wpjCode
Copy link

wpjCode commented Oct 24, 2019

这不搞笑吗,一个插件数据处理不好,导致要禁用其他插件耦合性这么高怎么用?

@tk103331
Copy link
Author

这不搞笑吗,一个插件数据处理不好,导致要禁用其他插件耦合性这么高怎么用?
罪魁祸首是Mockjs,拦截了XHR,没处理好

@xianjieye4215
Copy link

项目中使用了Mockjs,组件报错,在vue-element-admin找到了解决办法。

PanJiaChen/vue-element-admin#1466

下面是我的解决办法:

Mock.XHR.prototype.proxy_open = Mock.XHR.prototype.open;
Mock.XHR.prototype.open = function() {
    let responseType = this.responseType;
    this.proxy_open(...arguments)
    if (this.custom.xhr) {
        if (responseType) {
            this.custom.xhr.responseType = responseType
        }
    }
}

请问代码放在哪个部分呢,我用了,提示栈溢出

@rebider
Copy link

rebider commented Apr 23, 2020

mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants