const autoGenAsideNavs = [ { text: "可视化文件管理", to: "/visualFileTable1", icon: 'home' } ];
细粒度处理(类、方法)加注解:css
@CrossOrigin(origins = "http://localhost:4444")
全局处理:node
@Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("http://localhost:4444"); // .allowedMethods("PUT", "DELETE") // .allowedHeaders("header1", "header2", "header3") // .exposedHeaders("header1", "header2") // .allowCredentials(false).maxAge(3600); } }; } }
tips:此处配置的是“localhost”,若是您访问的是127.0.0.1的话仍是跨域失败的,聪明的你应该知道怎么解决。react
修改页面baseURL及url,method默认为get,data-binder中对应params。若是是post改成datawebpack
@DataBinder({ tableData: { // 详细请求配置请参见 https://github.com/axios/axios baseURL: 'http://localhost:8080/', url: 'complex-tab-table-list.json', params: { page: 1, }, defaultBindingData: { list: [], total: 100, pageSize: 10, currentPage: 1, }, }, }) @DataBinder({ tableData: { baseURL: 'http://localhost:8080/', url: 'user/listUserByCriteria', method: 'post', data: {}, //headers: { // Accept: 'application/json', // 'Content-Type': 'multipart/form-data' //} defaultBindingData: { list: [], total: 100, pageSize: 3, }, }, })
data-binder入门传送,据说近期会开源,坐等。ios
默认post的Content-Type是application/json,习惯了application/x-www-form-urlencoded的话,能够npm install qs来包装下,git
import qs from 'qs'; // TODO componentDidMount() { this.queryCache.pageIndex = 1; this.queryCache.pageSize = 3; this.data = qs.stringify({ ...this.queryCache }); this.fetchData(); } // data存放查询参数 fetchData = () => { this.props.updateBindingData('tableData', { data: this.data, }); };
demo依赖mock数据中currentPage来更新current,改为实际后台数据后,不建议这么照搬。可参照官方Paginationdemo修改current到state里。github
ice中提供了icon、FoundationSymbol两套图标。同时支持自定义图标DynamicIcon。css从iconfont获取(找到须要的图标添加到项目->选择Font class->生成地址)。注:目前采用fontclass引入字体图标,故不支持多色。web
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import DynamicIcon from 'dynamic-icon'; // 使用 custom 生成自定义 ICON 组件 const CustomIcon = DynamicIcon.create({ fontFamily: 'iconfont', prefix: 'icon', css: 'https://at.alicdn.com/t/font_1472628097_7496383.css' }); export default CustomIcon;
其余页面使用spring
import CustomIcon from '../../../../components/CustomIcon'; ... <CustomIcon type="dingding" />
node_modulesice-scriptslibconfigwebpack.config.dev.js
node_modulesice-scriptslibconfigwebpack.config.prod.jsnpm