<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
<script type="javascript">
Date.prototype.format = function(format){
if((format = "" || format == undefined)){
format ="yyyy-mm-dd h:m:s"
}
let conf =['yyyy','mm', 'dd','h','m','s','S'];
let arr = {
'yyyy':this.getFullYear(),
'mm':this.getMonth() +1,
'dd':this.getDate(),
'h':this.getHours(),
'm':this.getMinutes(),
's':this.getSeconds(),
'S':this.getMilliseconds(),
};
conf.forEach(function(item){
format= format.replace(item,arr[item])
});
return format;
};
// 添加到Vue原型上
Vue.prototype.$date = function (value) {
return new Date();
};
// 使用
new Vue({
el: '#app',
data:function(){
return {
time:46545
}
}
computed:{
time_str(){
return this.$date(this.time).format();
}
}
});
</script>
-
近期文章
- Apple Script 常用函数
- ubuntu 18.04 搭建wordress(LAMP)
- Node.js 爬电影天堂种子
- js常用正则验证器
- node.js 的爬虫puppeteer基本使用
- expect登录mysql
- 自己写一个简陋版Vue
- 超级全面的php文件操作
- Linux 使用expect交互方式ssh登录
- Linux 中添加登录通知脚本
- 一个简单的php socket服务端
- php 拓展包,依赖包,可视化
- 快捷指令:自动登录,上报健康,填写表单,上传图片
- Php在不实话化类的情况下,获取类的所有方法和形参
- php 获取函数或方法的形参和实参
- 免费的东西 你凭什么收费 “氧化钙” “化钙” “氧化钙”
- 我要创建“创建您自己的证书颁发机构”,看官方文档缺少选项。请极速回复
- jvectorMap 地理数据包整理集合
- GitHub Desktop for Mac 汉化语言包
- Vue项目中定时器动态修改时间间隔
- Vue-CLI中配置postcss-pxtorem自动将px转换为rem
- Layui V2.6.3 Table
- V2Ray 安装配置教程
- js中new Date().format()方法不可用问题
- 2022年前端CSS 框架排名
- wordpress 站点统计jMaps插件(测试版)
- ubuntu18.04 sudo apt-get install E: 无法定位软件包
- Js当前页面截图,并保存到本地
- appserv 的php多版本下载工具
- appserv本地开发环境,经常需要添加多站点,手动操作很麻烦,于是创建控制台操作
- fastAdmin 框架api模块认证问题
- php 控制台打印二维数组
- php QrReader解析二维码数据
- wordpress中mac风格代码高亮显示
- 原生js首字母大写
- python win32con 剪切板操作
近期评论
归档
分类