废话不多说上代码:
import React, {Component} from 'react';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import {ConfigProvider} from 'antd';
import ReactDOM from 'react-dom';
import App from './App';
import {BrowserRouter} from 'react-router-dom';
import {Provider} from 'react-redux';
import store from './redux/Store';
import api from './utiles/api';
import message from './utiles/mesage'
Component.prototype.api = api;
Component.prototype.message = message
ReactDOM.render(
<ConfigProvider locale={zh_CN}>
<Provider store={store}>
<BrowserRouter>
<App/>
</BrowserRouter>
</Provider>
</ConfigProvider>
, document.getElementById('root')
);
注意事项一: 引入中文包 跟 antd
注意事项二: 使用别名 ConfigProvider 把app.js 标签包起来就可以