1. 标准时间
const dateFun =function(date){
let val =new Date(date*1000)
// console.log(date,val,'这是转换时间的方法')
var y = val.getFullYear();
var m = val.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = val.getDate();
d = d < 10 ? ('0' + d) : d;
var time = y+'-'+m+'-'+d;
return time
}
export default dateFun
2. 判断后端返回接口的线上资源地址有没有写全
import _config from '@/utils/config.js'
export default function addDomainUrl(url) {
if (url.substring(0, 4) == 'http') {
// if(this.videoMsg.media_url.substring(0,4)=='http'){
console.log('wwww',url);
return url
} else {
console.log('eeeeee',_config.ossURL + url)
return _config.ossURL + url
}
}
3.uniapp开发中判断当前浏览器
let status = navigator.userAgent.toLowerCase();
export default function browser(){
if (status.match(/MicroMessenger/i) == "micromessenger") {
return '微信浏览器'
}else{
return '普通浏览器'
}
}