I hereby claim:
- I am ding-fan on github.
- I am dingfan (https://keybase.io/dingfan) on keybase.
- I have a public key ASDLnHDbUY4ENP34QT95Zr8sABpr9905AgDpk9xsIKvaYQo
To claim this, I am signing this object:
// 作业1: 摄氏度转换为华氏度 | |
function cToF (celsius) { | |
return celsius + ' 摄氏度等于 ' + (celsius * 33.8).toFixed(2) + ' 华氏度' | |
} | |
console.log(cToF(24)) | |
// 作业2:交换两个变量的值 |
I hereby claim:
To claim this, I am signing this object:
// 手机号校验 | |
// https://blog.csdn.net/voidmain_123/article/details/78962164 正则来源 | |
const validationRegExp = RegExp('^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$'); |
app.wpy 是入口文件,很多东西例如 globalData intercept onLaunch 都需要在这里配置。
其中 config 属性对应原生的 app.json 文件,build 编译时会根据 config 属性自动生成 app.json 文件,如果需要修改 config 中的内容,请使用微信提供的相关 API。
在 app.wpy 中,在 constructor 里的 intercept 里的 config 里,通过 url 是否开头含有 http:// 或 https:// 判断是否需要对通过 wepy.request 的请求添加 apiDomain ,起到类似 axios baseURL 的作用
if (!(/^https?:\/\//.test(p.url))) {
// 首先来看一些 pure function | |
(x) => x | |
// 这个 function 只用了一个 x ,并且这个 x 是 bound 在这个 function 的 scope 里的 | |
(x, y) => { | |
const z = 8 | |
return x + y + z | |
} | |
// 这个 function 用到了 x , y , z 。这三个家伙都是 bound 在这个 function 的 scope 内的。 |
const overlay = document.querySelector(".overlay"); | |
let lastScrollTop = 0; | |
// console.log("I'm in.") | |
// Apply initial styles | |
overlay.style.transition = "opacity 0.5s ease"; | |
overlay.style.opacity = "1"; | |
window.addEventListener("scroll", () => { |