小记-临时笔记
临时笔记
ajax tranditional 属性
//平时发送ajax,如果不用json格式,用普通传统方式,也没什么问题
//但是如果发送 数组list参数到后台,需要添加 tranditional : 'true' 属性,防止深度序列化,不然数组类型参数传到后台会报错
var postData = {};
postData.id = "123";
postData.list = ["1","2","4"];
$.ajax({
type:"POST",
async:true,
url:"url",
dataType:'json',
traditional : 'true',
data:postData,
success:function(result){
},error : function(jqXHR, textStatus, errorThrow){
}
});
没有 tranditional 属性 为 true 时
报错如下
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:470)
at java.lang.Integer.parseInt(Integer.java:499)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:959)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:921)
Truncated. see log file for complete stacktrace
ie9 不兼容问题 classList undefined,不能识别,
解决方式:
js 文件中加入下面代码
//ie9 兼容问题
if (!("classList" in document.documentElement)) {
Object.defineProperty(HTMLElement.prototype, 'classList', {
get: function() {
var self = this;
function update(fn) {
return function(value) {
var classes = self.className.split(/\s+/g),
index = classes.indexOf(value);
fn(classes, index, value);
self.className = classes.join(" ");
}
}
return {
add: update(function(classes, index, value) {
if (!~index) classes.push(value);
}),
remove: update(function(classes, index) {
if (~index) classes.splice(index, 1);
}),
toggle: update(function(classes, index, value) {
if (~index)
classes.splice(index, 1);
else
classes.push(value);
}),
contains: function(value) {
return !!~self.className.split(/\s+/g).indexOf(value);
},
item: function(i) {
return self.className.split(/\s+/g)[i] || null;
}
};
}
});
}
oracle 小数转字符小数点前面没有0的问题
oracle 在查询数据时,将一个小数 转为字符串,如果小数小于1 如 "0.35", 在转字符之后会被处理为 ".35"
常见解决方式
用 'to_char(num,"fm9990.99");'
fm去掉字符串前面的空格
9990.99表示4位数字,千位百位十位无数字时不显示[标识9],个位数[标识0]永久显示,小数没有不显示[标识9]
select 0.35 || '%' as rate from dual;
-- 结果 => .35%
select to_char(0.35,'fm9990.99') || '%' as rate from dual;
-- 结果 => 0.35%
Tomcat 配置文件 common.loader 参数
common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar"
前端 css 属性 加上 !important 导致页面样式修改不成功
//修改想要的页面样式,发现怎么修改都不能生效,很奇怪,后面检查才知道前端css有一种写法,最好权限优先级 : !important
//如果再css文件设置了某个属性值, 常见操作,document.getElementById('id').style.color = 'red' 是不能生效的,同样,标签内嵌样式页修改不了
// 需要setAttribute去设置,并在最后加上 !important
//如下:
<script type='text/javascript'>
document.body.setAttribute("style","overflow-y: auto !important"); //修改body 属性
document.documentElement.setAttribute("style","overflow-y: auto !important"); //修改html属性
document.getElementById('aDiv').setAttribute("style","height: 1024px !important");//修改某个div标签的高度
</script>
前端window.open打开页面 参数细节,以及传参
window.open(URL,name,specs,replace)
/*
URL url 要打开的页面路径 name 可选。指定target属性或窗口的名称。 _blank - URL加载到一个新的窗口。这是默认 _parent - URL加载到父框架 _self - URL替换当前页面 _top - URL替换任何可加载的框架集 name - 窗口名称
specs 可选。一个逗号分隔的项目列表。 第三个参数用逗号隔开 可以传参数 页面宽高,页面打开位置等 */
window.open(url,'new','width='+width+',height='+height+',left=100,top=100');
另外 打开新窗口后可能需要用到父页面的参数,需要传参, 这里有两种解决办法
1. 通过url将参数带过去
url?name=u&&age=18
2. 通过window.opener 获取父页面的参数,提前在父页面定义好全局变量
//在打开的新页面执行->
var parent_window = window.opener;
var name = parent_window.name;
var age = parent_window.age;
//能取到父页面全局变量 name 和 age的值
npm 命令与cnpm 命令
cnpm 与 npm命令 效果相同,
出现cnpm的原因是npm命令请求网络资源的时候,默认是国外服务器,可是国外服务器在国内不稳定(可能请求不到资源网路拥堵等原因);
于是就有了cnpm 命令,逻辑一样,只是请求网络资源请求的是国内的,国内搭建了镜像服务器(国内访问网络稳定)。
所以npm 和 cnpm命令是一样的,只是npm命令执行可能缓慢,因为国外服务器网络没有国内的稳定
项目初始安装
npm install
项目build 构建
npm run build
项目启动
npm run start
npm 前端项目检测修复命令 fix
cnpm audit fix 或者 npm audit fix
html
table
td 换行
https://www.cnblogs.com/HappyYawen/p/8521012.html

浙公网安备 33010602011771号