摘要: 防抖: function debounce(fn, delay){ let timer return function(...args) { if(timer){ clearTimeout(timer) } timer = setTimeout(() => { fn.apply(this,args) 阅读全文
posted @ 2022-02-25 15:27 落灯花 阅读(36) 评论(0) 推荐(0) 编辑
摘要: vue里面写法如下: export default function ({ isServer, req, redirect, route }) { let pcOrigin = 'https://www.xxxxx.com' let mobileOrigin = 'https://m.xxxxx.c 阅读全文
posted @ 2021-10-27 09:55 落灯花 阅读(652) 评论(0) 推荐(0) 编辑
摘要: showSource() { let _this = this _this.isHTML = !_this.isHTML let _source = this.editor.getHTML() if (_this.isHTML) { _source = _source.replace(/</g, " 阅读全文
posted @ 2021-10-26 14:59 落灯花 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 1.判断为空 小白: if(a == undefined) a = []; if(params.success){ params.success(res); } 优雅: a = a || []; params.success&&params.success(res); 2.多条件判断 小白: var 阅读全文
posted @ 2021-10-09 15:00 落灯花 阅读(75) 评论(0) 推荐(0) 编辑
摘要: HTML: <el-checkbox-group v-model="re_hotel" class="col-padding"> <el-col v-for="(hotel_item, hotel_id) in all_hotel_room" :key="hotel_id" :span="8"> < 阅读全文
posted @ 2021-07-05 18:10 落灯花 阅读(889) 评论(0) 推荐(0) 编辑
摘要: toThousandFilter(num) { return (+num || 0).toFixed(2).replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } 阅读全文
posted @ 2021-06-07 16:03 落灯花 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 时间按天数显示 getAllDate(start, end) { // 中国标准时间format yyyy-mm-dd const format = (time) => { let ymd = '' const mouth = (time.getMonth() + 1) >= 10 ? (time. 阅读全文
posted @ 2021-05-25 19:51 落灯花 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 创建getperiod.js class GetPeriod{ constructor() { this.now = new Date(); this.nowYear = this.now.getYear(); //当前年 this.nowMonth = this.now.getMonth(); / 阅读全文
posted @ 2021-05-17 12:03 落灯花 阅读(872) 评论(0) 推荐(0) 编辑
摘要: 为什么使用vuex? vuex主要是是做数据交互,父子组件传值可以很容易办到,但是兄弟组件间传值(兄弟组件下又有父子组件),或者大型spa单页面框架项目,页面多并且一层嵌套一层的传值,异常麻烦,用vuex来维护共有的状态或数据会显得得心应手。 需求:两个组件A和B,vuex维护的公共数据是 餐馆的名 阅读全文
posted @ 2021-04-06 14:38 落灯花 阅读(1386) 评论(0) 推荐(0) 编辑
摘要: formatter: function(params) { var relVal = [params[0].name]; for (var i=0;i<params.length;i++){ relVal += '\n' + params[i].seriesName+' ' + params[i]. 阅读全文
posted @ 2021-04-05 14:23 落灯花 阅读(1229) 评论(0) 推荐(0) 编辑