进入src /main/resources/servlet/ 修改sevlet-context.xml,之后找到14行
<bean id="velocityConfig"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/views_source/" />
<property name="configLocation" value="classpath:vel...阅读全文>>
每次css或js文件修改之后,浏览器因有缓存而无法及时的呈现最新的页面内容。
解决方法:用gulp自动给html引入的css,js文件批量添加版本号
原html效果:
<link rel="stylesheet" href="css/index.css"> <script src="js/index.js"></script>
完成效果
<link rel="stylesheet" href="css/index.css?v=d917434f5d"> <script src="js/index.js?v=1...阅读全文>>
var path = require("path");
var fs = require("fs");
console.log(__dirname)
let components = [];
var arrFiles=[];
var str=__dirname+"/css/";
function load(val){
const files = fs.readdirSync(val)
files.forEach(function (item, index) {
let stat = fs.lstatSync(val+item)
if (stat.i...阅读全文>>
方案一
<html> <body> <form action="" method="post" target="nm_iframe"> <input type="text" id="id_input_text" name="nm_input_text" /> <input type="submit" id="id_submit" name="nm_submit" value="提交" /> </form> <iframe id="id_iframe" name="nm_iframe" ...阅读全文>>
使用最新版本的 create-react-app(v2.1.0)创建 react 项目时,在 IE 9 & IE 10 中碰到了"Map未定义"的报错:
很明显,这是 IE9 对 ES6 的兼容性问题。首先尝试了两种方式:
使用 create-react-app 官方提供的 react-app-polyfill,然后在入口文件 index.js 中引入:
import 'react-app-polyfill/ie9'
根据 react 官方文档,使用 core-js 引入 polyfill:
...阅读全文>>
reruest.js:
/**
* 让fetch也可以timeout
* timeout不是请求连接超时的含义,它表示请求的response时间,包括请求的连接、服务器处理及服务器响应回来的时间
* fetch的timeout即使超时发生了,本次请求也不会被abort丢弃掉,它在后台仍然会发送到服务器端,只是本次请求的响应内容被丢弃而已
* @param {Promise} fetch_promise fetch请求返回的Promise
* @param {number} [timeout=120000] 单位:毫秒,这里设置默认超时时间为10秒
...阅读全文>>
import React from 'react';
import ReactDOM from 'react-dom';
class NewPortal extends React.Component {
constructor(props) {
super(props)
this.node = document.createElement('div');
document.body.appendChild(this.node);
}
render() {
const { children } = this.props;
...阅读全文>>
构建menu组件:
import React from 'react'
import {Link,withRouter} from 'react-router-dom'
import {Menu, Icon} from 'antd'
//此组件的意义就是将数据抽离出来,通过传递数据去渲染
@withRouter
class CustomMenu extends React.Component {
state = {
openKeys: [],
selectedKeys: []
}
componentDidMount() {
...阅读全文>>
render(){
return(
<div>
<EchartsReact option={option} ref={(e) => {
this.echartsReactRef = e;//chu
}} style={{height:2+"rem",width:'100%'}}/>
</div>
)
}
comp...阅读全文>>
1.在componentDidMount()中加入监听器
componentDidMount() {
this.screenChange();
}
screenChange() {
window.addEventListener('resize', this.resize);
}
resize()方法中,定义了屏幕尺寸变化后需要执行的代码
2.在constructor中绑定resize()
constructor(props) {
this.r...阅读全文>>