笔记
天蚕土豆丝
这个作者很懒,什么都没留下…
展开
-
相同key值时,复制后对象中属性值到前一个对象中
setValueSameKey (options1, option2) { Object.keys(options1).forEach(key => { if (option2.hasOwnProperty(key)) { options1[key] = option2[key] } }) },原创 2021-12-24 10:19:41 · 348 阅读 · 0 评论 -
获取图片的原始宽高
loadImg (url) { let img = new Image() img.src = url let that = this img.onload = function () { if (img.width / img.height > 1000 / 600) { that.fix = 'widthFix' } else { that.fix = 'heightFi...原创 2021-10-21 14:04:36 · 298 阅读 · 0 评论 -
小程序基础版本库与微信版本关系
小程序有基本版本库的概念,有些api在低版本基础库用不了,那么小程序运行在手机时,基础版本库跟微信版本有什么关系么,来看对比不同微信版本时的结果。原创 2021-07-29 15:06:30 · 2322 阅读 · 0 评论 -
vue项目省市区数组绑定到dom上,JS运行时间超长解决方案
https://dmp.hikvision.com/h5wechat/general/index.html?code=021P5mFa1rKUsB0ov3Ga12CDog1P5mFI&appId=wx8dc5d974555fbcb5#/registerResult原创 2021-07-27 14:36:41 · 181 阅读 · 0 评论 -
vue数组更新
原创 2021-06-22 15:19:02 · 92 阅读 · 0 评论 -
冒泡排序
let arr=[]let len = arr.lengthfor (j = 0; j < len - 1; j++){let flag = truefor (i = 0; i < len - 2 - j; i++){if (a[i] > a[i + 1]){temp = a[i];a[i] = a[i + 1];a[i + 1] = temp;}}if(flag){break}}原创 2021-03-22 14:15:30 · 66 阅读 · 0 评论 -
element el-date-picker 禁用多个时间段
项目需求要在联动的日期选择器里禁用后端返回的多个时间段,element官方案例中只禁用一个,而且是写死的。所以自己百度加处理实现了这个功能。1.data中 pickerOption: {disabledDate: function (date) { // 禁止选择今天之前的日期const today = new Date().toLocaleDateString()return date < new Date(today)}}这个是禁用当前时间的,我需要这个功能就带着了2.添加后端返回原创 2020-11-17 16:59:45 · 3068 阅读 · 3 评论