- 博客(6)
- 收藏
- 关注
原创 防抖和节流函数封装(函数原理和闭包的应用以及防抖和节流的区别,看看其他文章,大厂面试可能会用到)【看看loadsh的源码】
目录1.函数封装2.使用1.函数封装// export function throttle(fn, delay = 500) {// let prev = Date.now()// return function() {// let args = arguments// let now = Date.now()// if (now - prev >= delay) {// fn.apply(this, args);// prev = Dat.
2020-12-28 15:30:22 309
原创 微信小程序获取用户地理位置(uni-app)
step1: 原生的微信小程序需要在app.json中配置permission字段。uni-app则需要在manifest.json中配置,如下图step2:查看授权以及申请授权获取地理位置 getUserLocation() { uni.getSetting({ success: (res) => { if (!res.authSetting['scope.userLocation']) { console.log(res)
2020-12-23 10:10:54 3886 2
原创 微信小程序,点击tab,使当前tab出现的视野中 或者 滑动下面的swiper,使当前的tab出现在视野中(用的uni-app)(滑动的tab)
主要是 scroll-view 这个组件的使用,以及每一个tabItem一些属性的计算<template> <view id="estimate-answerV2" class="estimate-answerV2"> <view class="tab-nav"> <scroll-view :enable-flex="true" scroll-with-animation :throttle="false" :scroll-left="sc.
2020-12-22 15:23:58 766
转载 关于移动端使用position:fixed/absolute出现随屏幕滚动情况
https://blog.csdn.net/xiasohuai/article/details/88090462如下图,按钮使用了position:absolute绝对定位,但是在苹果手机上会随页面滚动,解决方法如下在position:fixed/absolute内加入-webkit-transform: translateZ(0);假如有遮罩情况则在内容区域,加入:margin-bottom:30px;//margin-top:30px;抖动情况,则在内容区域,加入 :...
2020-12-10 14:55:47 5646
原创 vue中。input输入框,限制1位小数,限制2位小数,不限制小数,限制不带小数点的数字
methods: { vSeachNumber1(prop) { // 不带小数点的数字 this.dataForm[prop] = this.dataForm[prop].replace(/[^\d]/g, '') }, vSeachPrice(prop) { // 带小数点的数字 this.dataForm[prop] = this.dataForm[prop].replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').
2020-12-08 10:46:37 2846
原创 微信小程序获取用户tel、获取用户信息(uni-app)
两者不能同时获取获取手机号需要后台接口配合<button @getuserinfo="wxGetUserInfo" open-type="getUserInfo">获取用户信息</button><button @getphonenumber="wxGetPhoneNumber" open-type="getPhoneNumber">获取用户手机号</button><script> wxGetUserInfo() { ..
2020-12-02 14:43:53 586
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人