1.使用css写出一个三角形角标
元素宽高设置为0,通过border属性来设置,让其它三个方向的border颜色为透明或者和背景色保持一致,剩余一条border的颜色设置为需要的颜色。
Css 三角形
Div{ height :0 ; width:0; border:5px solid #transparent ; border-top-color:red;}
2.Date对象
获取当前时间毫秒值
// 方式一
Date.now(); // 1606381881650
// 方式二
new Date() - 0; // 1606381881650
// 方式三
new Date().getTime() // 1606381881650
创建Date对象的兼容性问题。
// window和安卓支持,ios和mac不支持
new Date('2020-11-26');
// window和安卓支持,ios和mac支持
new Date('2020/11/26');