当前位置:网站首页>uniapp封装全局js并在页面引用
uniapp封装全局js并在页面引用
2022-08-09 15:03:00 【不知-_】
第一步:封装js
创建一个common文件夹,在common文件夹下创建public.js文件,内容如下:
(文件夹和文件命名可按照自己喜好)
var globalImg = 'http://xxx/'
function getFullTime(timestamp) {
let date = new Date(timestamp);
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1) + '-';
let D = date.getDate() + ' ';
let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D + h + m + s;
}
module.exports = {
globalImg: globalImg,
getFullTime: getFullTime,
}
在页面引用
边栏推荐
- Principal Component Analysis - Applications of MATLAB in Mathematical Modeling (2nd Edition)
- 数学规划模型
- 架构实战营第九模块作业-毕业项目
- PE format series _0x05: output table and relocation table (.reloc)
- Makefile通用模板
- Heap series _0x02: The past and present of the heap (WinDbg+Visual Studio compilation)
- DOS命令
- 缓存层与数据库层数据同步问题
- The practical skills Vim _5. Move quickly between files and documents
- MySQL数据库基本知识
猜你喜欢
随机推荐
模糊综合评价
GStreamer应用开发手册学习笔记之二
解决端口号被占用的情况
WinServer 2019 组策略开启远程桌面
The practical skills Vim _1. Vim way of solving problems
重启网卡提示Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization.
Ntdsutil 清除无效的辅域控制器DC
数组指针的使用方法
Word 2016 撰写论文(1): 公式居中、编号右对齐
FPGA--基础语句、计数器、测试仿真语句(个人学习记录2022.7.20)
【QT】窗口几何布局学习
VMware 虚拟机添加 2 张网卡 设置 NAT 与 桥接网络
FileInputStream与BufferedInputStream的区别
杭州富阳科目三新规3号线考试攻略
List,Set,Map,Queue,Deque,Stack遍历方式总结
2022.7.22FPGA学习总结:项目实践——按键消抖模块
webSocket的实现
ACL配置
Zip包的读取与写入
FFmpeg源码剖析-通用:ffmpeg_parse_options()