在最新的 Visual Studio 2015 中,ASP.NET Core Web 应用程序项目无法修复此错误:
Scripts\app\AppComponent.component.ts(7,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
Scripts\app\app.component.ts(7,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
Scripts\app\app.module.ts(16,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future …Run Code Online (Sandbox Code Playgroud) 我正在尝试模拟尚未在服务器上实现的 API。但是,如果我模拟请求,则仅适用于我模拟的请求。如果我在mock.restore();之后添加,mock.onGet那么真正的 API 工作正常,但是我也不需要模拟 API。
import * as axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
const mainConfig = require('../../../config/main.js');
const request = (axios as any).create({
baseURL: mainConfig.apiBaseUrl,
headers: {
'Content-Type': 'application/json',
},
});
const mock = new MockAdapter(request);
mock.onGet('basket').reply(200, {...});
export default request;
Run Code Online (Sandbox Code Playgroud)