1234567891011121314151617181920212223242526272829303132333435363738394041// 思路:获取时间戳的差// 时间差除以时间格式需要的倍数 如果超过1 则表示时间差在这个等级中function getDateDiff(dateTimeStamp) { const now = Date.now() const diffValue = now - dateTimeStamp if (diffValue < 0) { console.error('结束日期不能小于开始日期!') return } // 时间格式转换需要的数字倍数 const minute = 1000 * 60 // const hour = minute * 60// const day = hour * 24 // 几天前 const month = day * 30 // 月 // 时间差 除以时间格式需要的倍数 const monthC = diffValue ...
1、在vue项目中的index.html引入1<meta name="format-detection" content="telephone=yes" /> 2、在vue页面使用1234567 // 拨打电话methods:{ callPhone(phoneNumber) { console.log(phoneNumber); window.location.href = "tel://" + phoneNumber; },} 3、调用方法1234<div @click="callPhone(item.phone)"> 手机号</div>
123456789101112131415161718<div class="text">加载中,请稍后<span class="dot">...</span></div><style>.dot { font-family: simsun; /*固定字体避免设置的宽度无效*/ animation: dot 3s infinite step-start; display: inline-block; width: 1.5em; vertical-align: bottom; /*始终让省略号在文字的下面*/ overflow: hidden;}@keyframes dot { /*动态改变显示宽度, 但始终让总占据空间不变, 避免抖动*/ 0% { width: 0; margin-right: 1.5em; } 33% { width: .5em; margin-right: 1e ...
配置路由123456789101112131415161718192021222324252627export default new Router({ routes: [ { path: '/hello', name: 'HelloWorld', component: HelloWorld, meta: { keepAlive: true // 需要缓存 } }, { path: '/hello2', name: 'HelloWorld2', component: HelloWorld2, meta: { keepAlive: false // 不需要缓存 } } ], mode: 'history', scrollBehavior (to ...
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465function checkPersonIdcard(personnumber) { personnumber = personnumber.toUpperCase(); //身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X。 if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(personnumber))) { return false; } //校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。 //下面分别分析出生日期和校验位 var len, re; len = personnumber.length; if (len ...
我们在引入子组件时,子组件的名字一定要大写,否则会报错(这是个babel编译机制问题)。那么,父组件在引入子组件后,如何传值呢?首先,父组件要将传递的参数写到子组件标签上,然后,子组件通过props接收父组件传过来的所有参数。 组件Home向子组件Child传递count值,子组件通过props拿到此值并渲染出来。 父组件: 1234567891011121314151617181920212223import React, { useState } from 'react';import './index.less';import Child from './component/child'; const Home: React.FC = () => { const [count, setCount] = useState<number>(0); return ( <div className="home-wrap"> &l ...
父组件需要向子组件传递一个函数,然后,子组件通过props获取函数并附上参数,最后,父组件通过函数拿到子组件传递的值。 父组件 123456789101112131415161718192021import React, { useState } from 'react';import Child from './component/child';import './index.less'; const Home: React.FC = () => { const [parentCount, setParentCountt] = useState<number>(0); const getChildCount = (val: number) => { setParentCountt(val); }; return ( <div className="home-wrap"> <p> ...
官网api: https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.getUpdateManager.html app.js 123456789101112131415161718192021222324252627282930onShow : function() { this.checkForUpdate()},// 检查版本更新checkForUpdate(){ wx.getUpdateManager().onCheckForUpdate(res => { console.log('请求版本更新信息',res); if (res.hasUpdate) { // 新版本下载成功 wx.getUpdateManager().onUpdateReady(() => { wx.showModal({ title: '更新提示&# ...
(一)将前端 vue 项目部署到 Nginx1、官网下载 nginx 稳定版:http://nginx.org/en/download.html(如下载到 E:\nginx\nginx-1.18.0 目录中) 2、双击运行 nginx,然后通过查看任务管理器,确定 nginx 是否已经执行。 注意:nginx 默认端口号是80,如果端口号被占用,需要修改。 3、将前端 npm run build 打包后的 dist 文件夹复制到 html文件夹中 4、修改 E:\nginx\nginx-1.18.0\conf\nginx.conf 文件 (1)将 #user nobody 修改为 #user root 2)修改 serverroot 默认是 html,这里改为 html/dist ,nginx 会在 dist 文件夹中找到 index.html打开。(如果80端口号被占用,此处将端口号80改为 88或者其他) 修改完成之后,重新启动 nginx。在浏览器中输入 localhost:80 或者 127.0.0.1:80 即可打开项目。
微信小程序版本检查更新官网api: https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.getUpdateManager.html app.js 123456789101112131415161718192021222324252627282930onShow : function() { this.checkForUpdate()},// 检查版本更新checkForUpdate(){ wx.getUpdateManager().onCheckForUpdate(res => { console.log('请求版本更新信息',res); if (res.hasUpdate) { // 新版本下载成功 wx.getUpdateManager().onUpdateReady(() => { wx.showModal({ title: & ...
公告
博客微信小程序版已上线,同步更新,请扫码浏览。🎉