工具类
常用工具类
落花流雨
这个作者很懒,什么都没留下…
展开
-
.env前端配置多环境打包
.env前端环境变量配置参考资料:https://www.cnblogs.com/xiaohouzi6/p/14445570.htmlhttps://cli.vuejs.org/zh/guide/mode-and-env.html#%E6%A8%A1%E5%BC%8F项目有开发环境、测试环境、线上环境,里面的接口域名等是不同的。每次调试或者打包的时候手动改动各个变量,比较麻烦,也容易出错,所以用自动化方式直接配置的不同的环境变量。文件配置在项目根目录下添加文件,并配置变量.env转载 2021-09-13 15:27:46 · 1183 阅读 · 0 评论 -
Vue-i18n 实现中英文切换
中英文切换先安装依赖npm install vue-i18n创建文件在根目录新建i18n文件langs/cn.jsmodule.exports = { home: { title: '首页' }}langs/en.jsmodule.exports = { home: { title: 'home' }}index.jsimport VueI18n from 'vue-i18n';import Vue from 'vue';Vue.use(VueI转载 2021-07-11 10:44:11 · 296 阅读 · 0 评论 -
vue项目:工具类--获取url后面的参数
工具类:获取url后面的参数 code使用方法:需要获取什么参数,就写什么// 初始化调用this.GetUrlParam("code");// 从url中获取参数名为code的参数值var secneValueURl = this.getQueryString("code");// 获取url GetUrlParam(paraName) { let secneValue = window.localStorage.getItem("code"); if原创 2020-07-08 17:25:55 · 1020 阅读 · 1 评论 -
页面控制显示返回头部
页面控制显示返回头部(大佬提供)调用原生方法 window.ele_med_insurance.controlBackButton(b);b = 'true' 页面控制返回跳转;b = 'false' 原生控制返回方法;例 页面控制返回跳转;if(window.ele_med_insurance){//controlBackButton true 页面控制返回跳转 window.controlBackButton window.ele_med_insurance.co原创 2020-06-30 20:14:29 · 471 阅读 · 0 评论 -
vue项目--时间处理 time.js
vue项目–时间处理 time.js文件存放路径: src / lib / time.js使用方法:import { formatDay, formatDate, formatSecond, } from "@/lib/time";formatSecond(new Date().getTime())// 格式化年月日时分export function formatDate(date) { if (date == undefined) { return ""; } els原创 2020-07-10 11:27:05 · 1279 阅读 · 0 评论 -
功能点:时间处理(今天、昨天、去年)
当天数据:显示时分 示例:18:34昨天数据:显示昨天+时分 示例:昨天 18:34昨天-今年:显示月日时分 示例:12月23日 18:34去年之前:显示年月日时分 示例:2020年12月23日 18:34页面使用方法: {{jktTimes(时间戳)}}// 时间处理汇总jktTimes(time) { if (time == undefined) return ""; let now = new Date(); //今年 let repo.原创 2020-07-08 20:13:33 · 292 阅读 · 0 评论 -
工具类:多个数组组合成对象数组形式
工具类:多个数组组合成对象数组形式// 后台返回的数据格式:女|50|否|3.36|120|是|4.0|1.3|否|否this.paramName = this.queryObj.paramName.split("|");this.paramValues = this.queryObj.paramValue.split("|");this.referenceRange = this.queryObj.referenceRange.split("|");// 多个数组组合成对象数组形式const原创 2020-07-08 17:51:32 · 310 阅读 · 0 评论 -
工具类:判断手机系统 Android 或者 IOS
工具类:判断手机系统 Android 或者 IOS // 判断手机类型 AndroisIos() { let u = navigator.userAgent; let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //g let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 if原创 2020-07-08 17:34:27 · 236 阅读 · 0 评论