代码拉取完成,页面将自动刷新
同步操作将从 openwjh/amis-editor-demo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import React from 'react';
import {Provider} from 'mobx-react';
import {toast, alert, confirm} from 'amis';
import axios from 'axios';
import {MainStore} from './store/index';
import RootRoute from './route/index';
import copy from 'copy-to-clipboard';
export default function(): JSX.Element {
const store = ((window as any).store = MainStore.create(
{},
{
fetcher: ({url, method, data, config}: any) => {
config = config || {};
config.headers = config.headers || {};
config.withCredentials = true;
if (method !== 'post' && method !== 'put' && method !== 'patch') {
if (data) {
config.params = data;
}
return (axios as any)[method](url, config);
} else if (data && data instanceof FormData) {
// config.headers = config.headers || {};
// config.headers['Content-Type'] = 'multipart/form-data';
} else if (
data &&
typeof data !== 'string' &&
!(data instanceof Blob) &&
!(data instanceof ArrayBuffer)
) {
data = JSON.stringify(data);
config.headers['Content-Type'] = 'application/json';
}
return (axios as any)[method](url, data, config);
},
isCancel: (e: any) => axios.isCancel(e),
notify: (type: 'success' | 'error' | 'info', msg: string) => {
toast[type]
? toast[type](msg, type === 'error' ? '系统错误' : '系统消息')
: console.warn('[Notify]', type, msg);
console.log('[notify]', type, msg);
},
alert,
confirm,
copy: (contents: string, options: any = {}) => {
const ret = copy(contents, options);
ret && (!options || options.shutup !== true) && toast.info('内容已拷贝到剪切板');
return ret;
}
}
));
return (
<Provider store={store}>
<RootRoute store={store} />
</Provider>
);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。