Article directory
1. element-ui table form dislocation problem
Reset the style of the table;
.el-table__body {
width: 100%;
table-layout: fixed !important;
}
2. Date compatibility issues
- Reason: safari does not support
-
delimiter ,/
just convert to delimiter;- In order not to modify the previous code;
- The solution here is: Improve a new method,
覆盖
the original Date function;
// 保存原生Date
window.prototypeDate = Date;
// 替换原生Date, 兼容safri
class myDate extends Date {
constructor() {
let date = arguments[0];
if (date && typeof date === 'string') {
// - . \ / T : 空格
date = date.split(/[-\.\/\\T\s:]/);
let dateStr = ""
date[0] && (dateStr += date[0]); // 年
date[1] && (dateStr += "/" + date[1]); // 月
date[2] && (dateStr += "/" + date[2]); // 日
date[3] && (dateStr += " " + date[3]); // 时
date[4] && (dateStr += ":" + date[4]); // 分
date[5] && (dateStr += ":" + date[5]); // 秒
arguments[0] = dateStr;
}
super(...arguments);
}
}
window.Date = myDate;