Salad taste like sad.

数组方法

记录一些 JavaScript 常用的数组方法,以及参考例子。

数组方法

LeanCloud 国际版迁移国内节点记录

从8月开始,咕言就出现了访问没数据的问题,一番排查下来无果。

直到我看到了控制台内的公告:「2022 年 8 月起,国际版共享域名不再向中国大陆提供服务」

这才意识到,LeanCloud 的国际版直接停止了国内 IP 的请求,LeanCloud 我谢谢您。

解决的方案无非就是迁移回国内或者换一家国内的数据存储方案,或者自己写后端进行一番改造。

那么本着万物皆摸的原则!肯定是工作量越少越好,果断选择直接搬回国内!!!

LeanCloud 国际版迁移国内节点记录

右键快捷使用 WebStorm 打开项目

首先使用 Win+R 打开运行窗口,键入 regedit 打开注册表编辑器。

找到路径 HKEY_CLASSES_ROOT\Directory,在这个目录内找 sell

右键快捷使用 WebStorm 打开项目

H5 调起第三方地图软件(百度、腾讯、高德)

新的需求,项目为 H5 嵌入 App,需要让 H5 能直接调起第三方地图软件实现目标地点的导航。

食用方法很简单,直接跳转相应的 URL 即可,不过 H5 无法判断用户是否安装了相应的地图 App。

区分用户端环境

1
2
3
4
5
6
7
let ua = navigator.userAgent.toLowerCase()
if (ua.indexOf('like mac os x') > -1) {
this.OS = 'IOS'
}
if (ua.indexOf('android') > -1) {
this.OS = 'Android'
}
H5 调起第三方地图软件(百度、腾讯、高德)

VSCode 使用代码片段快捷生成 Vue3 模板

习惯了 Webstorm 快捷的代码模板,而 VSCode 默认是没有 Vue3 代码模板的,无法愉快的食用 Vue3,那就扒贴自己创建一个模板!

创建模板:

  1. 界面右上角「文件」-> 「首选项」-> 「配置用户代码片段」-> 「新建全局代码片段文件」-> 键入vue3.json 回车。

  2. 进行一个copy,具体模板自由发挥。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
// Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Print to console": {
"prefix": "vue3",
"body": [
"<template>",
" <div></div>",
"</template>",
"",
"<script setup lang='ts'>",
"$1",
"</script>",
"",
"<style scoped lang='stylus'>",
"</style>"
],
"description": "Log output to console"
}
}
VSCode 使用代码片段快捷生成 Vue3 模板