分解tool.js
This commit is contained in:
parent
fa056e547c
commit
48880c2f67
|
|
@ -1,6 +1,14 @@
|
|||
const tool = {
|
||||
/* localStorage */
|
||||
data: {
|
||||
/*
|
||||
* @Descripttion: 工具集
|
||||
* @version: 1.0
|
||||
* @LastEditors: sakuya
|
||||
* @LastEditTime: 2021年6月28日19:13:13
|
||||
*/
|
||||
|
||||
const tool = {}
|
||||
|
||||
/* localStorage */
|
||||
tool.data = {
|
||||
set(table, settings) {
|
||||
var _set = JSON.stringify(settings)
|
||||
return localStorage.setItem(table, _set);
|
||||
|
|
@ -20,9 +28,10 @@ const tool = {
|
|||
clear() {
|
||||
return localStorage.clear();
|
||||
}
|
||||
},
|
||||
/* Fullscreen */
|
||||
screen(element){
|
||||
}
|
||||
|
||||
/* Fullscreen */
|
||||
tool.screen = function (element) {
|
||||
var isFull = !!(document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement || document.fullscreenElement);
|
||||
if(isFull){
|
||||
if(document.exitFullscreen) {
|
||||
|
|
@ -45,13 +54,15 @@ const tool = {
|
|||
element.webkitRequestFullscreen();
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 复制对象 */
|
||||
objCopy(obj){
|
||||
}
|
||||
|
||||
/* 复制对象 */
|
||||
tool.objCopy = function (obj) {
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
},
|
||||
/* 日期格式化 */
|
||||
dateFormat(date, fmt='yyyy-MM-dd'){
|
||||
}
|
||||
|
||||
/* 日期格式化 */
|
||||
tool.dateFormat = function (date, fmt='yyyy-MM-dd') {
|
||||
date = new Date(date)
|
||||
var o = {
|
||||
"M+" : date.getMonth()+1, //月份
|
||||
|
|
@ -71,9 +82,10 @@ const tool = {
|
|||
}
|
||||
}
|
||||
return fmt;
|
||||
},
|
||||
/* 千分符 */
|
||||
groupSeparator(num){
|
||||
}
|
||||
|
||||
/* 千分符 */
|
||||
tool.groupSeparator = function (num) {
|
||||
num = num + '';
|
||||
if(!num.includes('.')){
|
||||
num += '.'
|
||||
|
|
@ -81,7 +93,6 @@ const tool = {
|
|||
return num.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
|
||||
return $1 + ',';
|
||||
}).replace(/\.$/, '');
|
||||
}
|
||||
}
|
||||
|
||||
export default tool
|
||||
|
|
|
|||
Loading…
Reference in New Issue