vue-cli快速搭建项目的几个文件(二)
=======ggcss样式========
:root{
--bgColor : #d3252a;
--pinkColor : #ff4e81;
--textColor : #d3252a;
--selectdBg:#823d3e;
}
.colorRed{
color: #f24646;
}
.colorBlue{
color: #4e8eff;
}
.colorGreen{
color: #37bc3e;
}
/* 93%居中 */
.widMargin{
width: 100%;
}
.marginAuto{
margin: 0 auto;
}
.marg93{
width: 93%;
margin: 0 auto;
}
/* 透明度 */
.opacinone{
opacity: 0;
}
.disNone{
display:none!important
}
/* 弹性盒 */
.flex-around{
display: flex;
justify-content: space-around;
align-items: center;
}
.flex-center{
display: flex;
justify-content: center;
align-items: center;
}
.flex-left{
display: flex;
justify-content: left;
align-items: center;
}
.flex-between{
display: flex;
justify-content: space-between;
align-items: center;
}
.flex-between-top{
display: flex;
justify-content: space-between;
align-items: top;
}
/* inputNone */
.inputNone{
background: none;
border: 0;
outline: 0;
color: #696969;
font-size: 15px;
text-indent: 10px;
display: block;
height: 38px;
}
.inputNone:focus{
color: black;
}
/* 取消默认样式 */
img, span{
display: block;
}
.borderNone{
border: 0!important;
}
/* header+footer+body自适应 */
.AllPage{
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
position: absolute;
}
.ScrollContent{
width: 100%;
overflow:scroll;
flex:10%;
}
/* button默认 */
button{
border: 0;
display: block;
padding: 0;
}
/* 弹性盒,怪异盒模型盒阴影 */
.boxTurnStr{
box-sizing: border-box;
}
.boxShado{
box-shadow:#e8e0e0 0px 11px 6px -10px
}
/* 万恶的定位 */
.posiRelat{
position: relative;
}
.posiAbsol{
position: absolute;
}
.posiFixed{
position: fixed;
}
/* input弹起软键盘改变样式 */
.inputKeyBordStyle{
position: fixed;
top: 0;
}
==========引入封装方法=========
// 处理时间相关
import timer from '../commonFunction/timer'
Vue.prototype.timer=timer
export default{
// 获取当前时间:20200424
getNowTime(){
let date = new Date();
let seperator1 = "";
// let seperator1 = "-";
let year = date.getFullYear();
let month = date.getMonth() + 1;
let strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9){
strDate = "0" + strDate;
}
return year + seperator1 + month + seperator1 + strDate;
},
// 时间戳转时间 2020-4-24 00:30:00
timeStamp(val) {
if(val.length == 10) {
let time = val * 1000;
let timestamp4 = new Date(time);
return (timestamp4.toLocaleDateString().replace(/\//g, "-") +" " + timestamp4.toTimeString().substr(0, 8));
} else {
let timestamp4 = new Date(val);
return (timestamp4.toLocaleDateString().replace(/\//g, "-") +" " +timestamp4.toTimeString().substr(0, 8));
}
},
// 20200426=>2020-04-26
insertStr(soure, start, newStr){
return soure.slice(0, start) + newStr + soure.slice(start);
},
getNowTime0(){
let date = new Date();
let seperator1 = "0";
// let seperator1 = "-";
let year = date.getFullYear();
let month = date.getMonth() + 1;
let strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9){
strDate = "0" + strDate;
}
return year + seperator1 + month + seperator1 + strDate;
},
// 任意带'-'时间转四位带0月份
handeldata(str){
for(let i=0;i<str.length;i++){
if(str.length==3){ //1-1 0101 长度3
return '0'+str[0]+'0'+str[2]
}else if(str.length==4){ //1-23 0123和1203 长度4
if(str[1]=='-'){
return '0'+str[0]+str[2]+str[3] //12-3 和1203 长度4
}else if(str[2]=='-'){
return str[0]+str[1]+'0'+str[2]
}
}else{ //12-21
return str[0]+str[1]+str[3]+str[4]
}
}
},
// 2017-4-8转2017-04-08 或者2010-7-24 2010-07-24
handeldate(m){
let o = m[0]+m[1]+m[2]+m[3]
if(m.length==9){
if(m[6]=='-'){
return o+m[4]+'0'+m[5]+m[6]+m[7]+m[8]
}
if(m[7]=='-'){
return o+m[4]+m[5]+m[6]+m[7]+'0'+m[8]
}
}else if(m.length==8){
return o+m[4]+'0'+m[5]+m[6]+'0'+m[7]
}else{
return m
}
}
}
使用:方法内:
this.timer.getNowTime()