vhxubo / blog Goto Github PK
View Code? Open in Web Editor NEW开发过程中遇到的问题以及对应的解决方案
Home Page: https://vhxubo.github.io/blog/
开发过程中遇到的问题以及对应的解决方案
Home Page: https://vhxubo.github.io/blog/
$ yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration
在vue.config.js
新增
module.exports = {
pluginOptions: {
electronBuilder: {
nodeIntegration: true
}
}
}
Moment.js 的 2kB 轻量化方案,拥有同样强大的 API
var utc = require('dayjs/plugin/utc') // dependent on utc plugin
var timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc)
dayjs.extend(timezone)
dayjs().tz('Asia/Shanghai') // 获取上海时间
dayjs.tz.guess() // 猜测当前时区
// dayjs.tz.setDefault("America/New_York") // 用来设置默认时区
在别的视频中看到别人的className
显示很好看,于是想尽方法去寻找那个字体
最后,当我放弃的时候,发现CSS Modules and React | CSS-Tricks中使用到该字体:Operator Mono Ssm,但是对于我想要的那个好看的样式,需要在 italic 模式下
于是乎,在搜索 Operator Mono 字体时,发现beichensky/Font: FiraCode 和 Operator Mono 字体中的设置文章
"editor.fontFamily": "Operator Mono",
"editor.fontLigatures": true,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"name": "italic font",
"scope": [
"comment",
"keyword",
"storage"
],
"settings": {
"fontStyle": "italic"
}
},
]
}
但是,这里面的 scope 覆盖的太多,通过 > inspectTMScopes
便可以知道指定的文本在哪个范围下
最终的配置文件如下
"editor.fontFamily": "Operator Mono lig, Sarasa Term SC",
"editor.fontLigatures": true,
"editor.formatOnType": true,
"editor.lineHeight": 1.5,
"editor.fontWeight": "400",
"editor.cursorWidth": 5,
"editor.cursorBlinking": "solid",
"editor.fontFamily": "Dank Mono, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
//following will be in italic
"comment",
"emphasis",
"entity.name.method.js",
"entity.name.class.js",
"entity.name.tag.doctype",
"entity.other.attribute-name",
"entity.other.attribute-name.tag.jade",
"entity.other.attribute-name.tag.pug",
"keyword",
"keyword.control",
"keyword.operator.comparison",
"keyword.control.flow.js",
"keyword.control.flow.ts",
"keyword.control.flow.tsx",
"keyword.control.ruby",
"keyword.control.module.ruby",
"keyword.control.class.ruby",
"keyword.control.def.ruby",
"keyword.control.loop.js",
"keyword.control.loop.ts",
"keyword.control.import.js",
"keyword.control.import.ts",
"keyword.control.import.tsx",
"keyword.control.from.js",
"keyword.control.from.ts",
"keyword.control.from.tsx",
"keyword.operator.expression.delete",
"keyword.operator.new",
"keyword.operator.expression",
"keyword.operator.cast",
"keyword.operator.relational",
"keyword.operator.sizeof",
"keyword.operator.logical.python",
"italic",
"markup.italic",
"markup.quote",
"markup.changed",
"markup.italic.markdown",
"markup.quote.markdown",
"markup.deleted.diff",
"markup.inserted.diff",
"meta.delimiter.period",
"meta.diff.header.git",
"meta.diff.header.from-file",
"meta.diff.header.to-file",
"meta.tag.sgml.doctype",
"meta.var.expr",
"meta.class meta.method.declaration meta.var.expr storage.type.js",
"meta.decorator punctuation.decorator",
"meta.selector",
"punctuation.accessor",
"punctuation.definition.comment",
"punctuation.definition.template-expression.begin",
"punctuation.definition.template-expression.end",
"punctuation.section.embedded",
"quote",
"source.js constant.other.object.key.js string.unquoted.label.js",
"source.go keyword.package.go",
"source.go keyword.import.go",
"source.go keyword.function.go",
"source.go keyword.type.go",
"source.go keyword.struct.go",
"source.go keyword.interface.go",
"source.go keyword.const.go",
"source.go keyword.var.go",
"source.go keyword.map.go",
"source.go keyword.channel.go",
"source.go keyword.control.go",
"storage",
"storage.type",
"storage.modifier",
"storage.type.property.js",
"storage.type.property.ts",
"storage.type.property.tsx",
"tag.decorator.js entity.name.tag.js",
"tag.decorator.js",
"text.html.basic entity.other.attribute-name.html",
"text.html.basic entity.other.attribute-name",
"variable.language",
"variable.other.object.property"
],
"settings": {
"fontStyle": "italic"
}
}
]
}
.pretterrc
和.eslintrc.js
$ npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
$ npx tailwindcss init -p
默认没有密码
mysql -u root
mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
mysql -u root -p
修改密码格式
mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Seconds Minutes Hours DayofMonth Month DayofWeek Year
Seconds Minutes Hours DayofMonth Month DayofWeek
<v-data-table
:headers="headers"
:items="desserts"
:search="search"
@dragstart.native.prevent
@dragover.native.prevent="getDraggedFile"
@dragleave.native.prevent
@drop.native.prevent="getDroppedFile"
></v-data-table>
methods: {
getDroppedFile(event) {
console.log(event.dataTransfer.files[0]);
},
getDraggedFile(event) {
console.log(event.dataTransfer.items[0]);
}
}
https://cn.vuejs.org/v2/guide/list.html
https://cn.vuejs.org/v2/guide/reactivity.html
清空数组,使用 concat 触发
this.desserts = []
this.desserts = this.desserts.concat(db.get('items').value())
使用 concat 触发并引入 lodash 进行数据去重
const _ = require('lodash')
this.desserts = _.uniq(this.desserts.concat(db.get('items').value()))
javascript对象的浅拷贝、深拷贝和Object.assign方法浅析_贝贝的前端 - SegmentFault 思否
使用了数据的浅拷贝(直接赋值),应当使用深拷贝解决
浅拷贝直接引用的地址
this.item = item
使用数据的深拷贝对数据进行转移
this.item = Object.assign({}, item)
import { app, protocol, BrowserWindow, Menu } from 'electron'
...
Menu.setApplicationMenu(null)
Windows Terminal更新了配置文件方案,相比之前的json文件方便多了,正好电脑上次配置的没了,这次重新配置一下
代码补全还是需要安装PSReadLine
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck // 7自带
Cascadia Code PL
notepad $PROFILE
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme powerlevel10k_lean
$env:http_proxy="http://127.0.0.1:7890"
$env:https_proxy="http://127.0.0.1:7890"
块格式化上下文(Block Formatting Context,BFC) 是Web页面的可视CSS渲染的一部分,是块盒子的布局过程发生的区域,也是浮动元素与其他元素交互的区域。
说实话,我还是不知道它到底是个啥
.echarts {
width: 100%;
height: 100%;
}
autoresize
proppackage-lock.json
npm i
npm serve
.prettierrc
{
"semi": false,
"singleQuote": false,
}
.eslintrc.js
{
"rules": {
"quotes": ["error","single"]
}
}
offsetWidth, clientWidth, scrollWidth and Height, respectively in CSS - GeeksforGeeks
<svg>
的颜色修改style="fill:red"
以及style="stroke:red"
window.onbeforeunload = (event) => {
// Cancel the event as stated by the standard.
event.preventDefault()
// Chrome requires returnValue to be set.
event.returnValue = ''
return '关闭提示'
}
transform: rotateY(180deg);
打开你的终端并执行
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct
完成。
打开你的终端并执行
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn
或者
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
完成。
打开你的 PowerShell 并执行
C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"
/usr/lib/lua/luci/model/cbi
/usr/lib/lua/luci/controller
配置文件 /etc/config
文件权限 /usr/share/rpcd/acl.d
在开发调试的时候,需要删除 /tmp
下形如 luci-indexcache...lua
和luci-indexcache..json
的文件以及luci-modulecache
目录,然后刷新页面,并且只有关闭页面才可以删除
Eleventy (11ty)是一个简单的静态博客生成器,支持liquid
我最喜欢它的一点是,它可以从任何地方获取到data,而不仅仅局限于本地创建的md文件
好想去玩Gatsby哎。。。
_data
数据定义在_data下创建一个新的文件,譬如posts,返回值应该为一个数组元素,对应liquid模板中也是posts,我们可以使用for循环对数据进行循环。加上分页我们就可以对每一项数据生成一页对应的数据。
js 文件里,匿名函数开头有个 ;! 意义是什么?_happydecai的博客-CSDN博客
js 文件结束 处是 没有 分号的。若几个 js 连在一起时,2个 js 连接处 会发生语法上的混淆。
开头加 ; 用于分隔, 可以避免多文件 压缩 在一起时 引起的 错误。
分号和分号放在一起也没问题,相当于 “空语句”。
加号。相当于加了一层小括号。例如:
+function(){}();
相当于:
(function() { console.log("Foo!"); })();
// 或相当于
(function() { console.log("Foo!"); }());
如果没有这个加号的话,解析器会认为function是一个函数声明的开始,而后面()将会导致语法错误。在function前面加上+号时,
就变成了一个函数表达式,而函数表达式后面又添加了一个()就变成了一个立即执行的函数了。
vm.$set
对数组数据进行更新location.reload()
对页面进行强制刷新confrim()
可以获取到返回值,确定为true
,否则反之闭包的好处
闭包的好处: 1.希望一个变量长期保存内存中; 2.避免全局变量污染; 3私有成员的存在。
闭包有三个特性:
1. 函数嵌套函数;
2. 内部函数使用外部函数的参数和变量;
3. 参数和变量不会被垃圾回收机制回收。
SPA优缺点
优点:
无刷新切换内容,提高用户体验。
符合前后端分离的开发**,通过ajax异步请求数据接口获取数据,后台只需要负责数据,不用考虑渲染。前端使用vue等MVVM框架渲染数据非常合适。
减轻服务器压力,展示逻辑和数据渲染在前端完成,服务器任务更明确,压力减轻。
后端数据接口可复用,设计JSON格式数据可以在PC、移动端通用。
缺点:
不利于SEO(搜索引擎优化),应用数据是通过请求接口动态渲染,不利于SEO。
首页加载慢,SPA下大部分的资源需要在首页加载,造成首页白屏等问题。
v-show和v-if的区别
在切换 v-if 块时,Vue.js 有一个局部编译/卸载过程,因为 v-if 之中的模板也可能包括数据绑定或子组件。v-if 是真实的条件渲染,因为它会确保条件块在切换当中合适地销毁与重建条件块内的事件监听器和子组件。
v-if 也是惰性的:如果在初始渲染时条件为假,则什么也不做——在条件第一次变为真时才开始局部编译(编译会被缓存起来)。
相比之下,v-show 简单得多——元素始终被编译并保留,只是简单地基于 CSS 切换。
一般来说,v-if 有更高的切换消耗而 v-show 有更高的初始渲染消耗。因此,如果需要频繁切换 v-show 较好,如果在运行时条件不大可能改变 v-if 较好。
Ajax流程
==和===的区别
vue各个周期
Webpack是一个前端打包工具,只能用于采用模块化开发的项目。
Webpack最主要的就是各种loader和plugin
v5与v4差别较大,在使用时以官网文档为准。
对于学习还是需要用到再去学比较好呀,笼统的全学了太难为人了
通常比较推荐的做法是,在每次构建前清理 /dist 文件夹,这样只会生成用到的文件。让我们使用 output.clean 配置项实现这个需求。
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
index: './src/index.js',
print: './src/print.js',
},
plugins: [
new HtmlWebpackPlugin({
title: 'Output Management',
}),
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true, //like this
},
};
https://ifttl.com/add-flypy-to-win10-microsoft-pinyin-and-other-configuration/
首先打开注册表,找到这个路径
计算机\HKEY_CURRENT_USER\Software\Microsoft\InputMethod\Settings\CHS
然后新建一个名为 UserDefinedDoublePinyinScheme0
的字符串值,数值数据为
小鹤双拼*2*^*iuvdjhcwfg^xmlnpbksqszxkrltvyovt
如果使用 Windows PowerShell,必须使用引号将启动项标识符引起来,例如:“{49916baf-0e08-11db-9af4-000bdbd316a0}”或“{current}” 。1
bcdedit /copy "{default}" /d "Windows 11 With Off Hyper-V"
bcdedit /set "{f40847d6-13a4-11ec-a306-00155d9d7c47}" hypervisorlaunchtype Off
f40847d6-13a4-11ec-a306-00155d9d7c47
来自上一条命令
小软件/不方便更新的软件使用 Chocolatey 安装
Fndroid/clash_for_windows_pkg: A Windows/macOS GUI based on Clash
Chocolatey Software | Chocolatey - The package manager for Windows
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install listary
# choco install 7zip
choco install peazip
choco install treesizefree
choco install mpv
choco install git
choco install internet-download-manager
choco install autohotkey
BT Tracker 服务器地址大全与常用 BT 软件下载地址 Tracker List - DNS.iCoA.CN
imports
exports
加入以下代码后不能正常使用
constructor(
@InjectRepository(User)
private usersRepository: Repository<User>,
) {}
imports: [TypeOrmModule.forFeature([User])],
在Windows下面使用curl,需要对双引号进行转义
查询 https://site.ip138.com/raw.githubusercontent.com/
$ sudo vim /etc/hosts
填入
151.101.76.133 raw.githubusercontent.com
const pro1 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve('pro1 done')
}, 1000)
})
pro1.then(value => console.log(value))
// result: pro1 done
function con (msg, time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(msg)
}, time)
})
}
con('hello', 1000).then(value => console.log(value))
三种状态,两个内置函数;一旦承诺,无法从外部终止;多个promise不会
堵塞
Promise构造函数接受一个函数作为参数,该函数的两个参数分别是resolve和reject。它们是两个函数,由 JavaScript 引擎提供,不用自己部署。
resolve(value) — 如果任务成功完成并带有结果 value。
reject(error) — 如果出现了 error,error 即为 error 对象。
state — 最初是 "pending",然后在 resolve 被调用时变为 "fulfilled",或者在 reject 被调用时变为 "rejected"。
result — 最初是 undefined,然后在 resolve(value) 被调用时变为 value,或者在 reject(error) 被调用时变为 error。
Promise.all
会等待耗时最长的promise,如果遇到失败,则全部失败。成功返回value数组。
以下代码将在5000ms后直接报错。
const pro1 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve('pro1 done')
}, 1000)
})
const pro2 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve('pro2 done')
}, 2000)
})
const proerror = new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('fuck'))
}, 5000)
})
Promise.all([pro1, pro2, proerror]).then(values => console.log(values))
useState
组件的状态管理
const [name, setName] = useState('')
// 懒加载初始化? 只在需要的时候执行
const [name, setName] = useState(
() => window.localStorage.getItem('name') || ''
)
useEffect
页面副反应
// 在每次页面更新都触发
useEffect(() => {
console.log('DOM updated')
})
// 只在页面第一次渲染的时候触发
// 适用于初始化 JSON 数据等
useEffect(() => {
console.log('Only on Mounted')
}, [])
// 根据数据状态进行数据更新
useEffect(() => {
console.log('name updated')
}, [name])
// 在页面退出时执行, 类似于 Vue3 中的 `onUnmounted`
useEffect(() => {
return () => {
// 这里填写推出后最后执行的副反应
}
})
useRef
获取 DOM 对象
// 因为在最开始的时候不加载 DOM, 需要配合 useEffect 使用
cosnt elemRef = useRef()
useEffect(() => {
const elemNode = elemRef.current
console.log(elemNode)
}, [])
最近一段时间遇到了很多问题,也学到了很多零碎的知识。
完成了两个新的个人项目vhxubo/websites和vhxubo/website-navigation。
很久之前就想完成整个项目,但是之前一直因为不懂怎么去做,现在做出来了。
做出来的确没有花很长时间,但是后面逐步的优化挺浪费时间和精力的。
使用local Storage存储一个theme变量,同时监听系统对黑暗模式的运用,window.matchMedia('(prefers-color-scheme: dark)').matches
ref的异步操作还是需要使用watch,watchEffect进行监听数据的变化,不然在setup里面根本得不到数据,因为在获取数据的时候,它可能还没有得到结果。
每次遇到问题就很难受,但是问题解决之后,好像它又没有那么难了。。。选择性遗忘?
想做一个类库,但是总是没有机会去学习,哎
发布
npm adduser
npm publish
# 升级补丁版本号
$ npm version patch
# 升级小版本号
$ npm version minor
# 升级大版本号
$ npm version major
P.S 记得发布,发布之后可能需要两分钟才能看到
2021.04.17
今天心血来潮,想着用jQuery来做一个浏览器插件吧,结果差点掉坑里出不来了
jQuery在一定程度上原生舒服多了,很方便的,不懂得为什么很多人不喜欢他,可能做的都是大一点的项目吧
总结一下今天用到的几个API
// Shorthand for $( document ).ready()
$(function() {
console.log( "ready!" );
});
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "ready!" );
});
$('#labels').append('<p>label</p>'); //可以是数组
$.ajax()
记得后面的.
在处理提交data时,data:JSON.stringify({username:'xxx'})
,再将dataType设置为json
直接写入
header:{Accept:''}
也可以在系统设置里面直接设置,硬件 输入设备 键盘
在Linux上运行Visual Studio代码
[Arch Linux] [Manjaro] How to avoid "Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)
To avoid this error, we need to increase the inotify watcher limit.
The way to do this is different on Arch based distributions than other Linux distributions.
Check for an already existing inotify config file
(recent versions of Manjaro include one)
ls /etc/sysctl.d/*-max_user_watches.conf
echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system
(in the rare case where it outputs multiple files, continue using the last one in the list)
# replace `/etc/sysctl.d/50-max-user-watches.conf` with the file returned from the previous `ls` command
echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/50-max_user_watches.conf && sudo sysctl --system
cat /proc/sys/fs/inotify/max_user_watches
Expected output: 524288
$ sudo pacman -Scc
$ sudo pacman -Rns $(pacman -Qtdq)
$ journalctl --vacuum-size=50M
How To Convert DEB Packages Into Arch Linux Packages - OSTechNix
Editor: Format On Save
Editor: Code Actions On Save
"editor.codeActionsOnSave":{
"source.fixAll": true
}
https://stackoverflow.com/questions/62894666/path-and-name-of-exe-file-of-windows-terminal-preview
快捷键: Ctrl + Shift + C
配置项
"terminal.external.windowsExec": "%LocalAppData%\\Microsoft\\WindowsApps\\wt.exe"
这个问题困扰了我好长时间,在module.exports
exports
export
中迷惑不已
只有在type="module"
时才可以使用到export
和import
分为 CommonJS 和 ESM
还有 UMD 和 AMD
默认导出不能和后面的 {} 类型导出在一起, 否则会被 {} 导出覆盖
const xx = require()
/ const { xx } = require()
module.exports
exports
// 默认导出
module.exports = var/function
// 导出一个
module.exports.a = a
// 导出多个, 注意在 ES5 中没有结构
module.exports = {
a: a,
b: b
}
import xx from ''
/ import { xx } from ''
export
export default
// 默认导出
export default var/function
// 导出一个
export a
// 导出多个
export { a, b }
通过使用 vuex 提供的 createLogger
插件,在 console 中查看
我的解决方案:location.href='/room/xxxx'
官方解决方案
v-model
v-model默认绑定的是value,针对表单数据的。如果是自定义组件,记得修改监听
在Vue3中提供了modelValue
和update:modelValue
,对应v-model
的使用
自定义组件使用数据流双向绑定时,需要设置为其他的,否则还是单向的数据
在使用props作为响应式时一定是用toRefs()
解耦操作
子组件
<template>
{{ jsonRef }}
<button @click="addJson">add</button>
</template>
<script>
import { ref, watch,toRefs } from 'vue'
export default {
props: ['json'],
emits: ['update:json'],
setup(props, context) {
// 这样是不行的,怎么说呢,就是这个数据太深入了监听不到
// const jsonRef = ref(props.json)
//应该是这样的***********
const { json: jsonRef } = toRefs(props)
const addJson = () => {
jsonRef.value += 1
}
//自定义事件中可以进行watch对数据进行更新
watch(jsonRef, () => {
context.emit('update:json', jsonRef.value)
})
return { jsonRef, addJson }
},
}
</script>
父组件
<template>
<div class="home">This is the home page</div>
<Test v-model:json="json" />
</template>
<script>
import Test from '@/components/Test.vue'
import { ref, watch } from 'vue'
export default {
name: 'Home',
components: { Test },
setup() {
const json = ref('hello emit')
// 父组件监听数据
watch(json, () => console.log(json.value))
return { json }
},
}
</script>
.value
toRaw
还原数据watch
对数据进行监听除了beforecate和created(它们被setup方法本身所取代),我们可以在setup方法中访问的API生命周期钩子有9个选项:
Vue 3 生命周期完整指南 - SegmentFault 思否
在 setup 中写新的函数调用库函数
模板调用
{{ dateTimeFormat(datetime) }}
函数设定
const dateTimeFormat = datetime =>
dayjs(datetime).format("YYYY-MM-DD HH:mm:ss");
Linux:~/.config/mpv/mpv.conf
Windows:``
no-border # no window title bar
save-position-on-quit # 记忆上次播放的位置
keep-open # 播放结束后不退出
ontop # 在全屏的情况下,更容易进入全屏独占 "T"
mpv/autoload.lua at master · mpv-player/mpv:自动加载当前播放文件目录里的视频文件到播放列表
实现针对 Issue 的进度提醒
有的文章下面有很多的评论,而浏览器的滚动条是全局的进度,对阅读很不友好。阮一峰的ES6教程中就实现了文章进度条的功能,很舒服。
使用油猴脚本实现:
// ==UserScript==
// @name GitHub Issue Read Process
// @namespace http://tampermonkey.net/
// @version 0.1
// @description GitHub Issue 阅读进度
// @author Vhxubo
// @match https://github.com/*/*/issues/*
// @run-at document-end
// @grant none
// ==/UserScript==
(function() {
'use strict';
var element = document.querySelector('.js-issue-timeline-container');
if (element){
var processEle = document.createElement('div');
var processStr = document.createTextNode('0%');
processEle.style.cssText = 'position:fixed;bottom:0px;left:0px;z-index:9999;font-height:800;font-size:2rem;color:#d1d5da;user-select:none';
processEle.appendChild(processStr);
document.body.appendChild(processEle);
window.addEventListener('scroll',function(){
var process = Number.parseInt((document.documentElement.scrollTop/(element.offsetTop-window.innerHeight))*100);
if (process >= 0 && process <= 100)
{
processEle.innerText = process+'%';
}else{
processEle.innerText = '100%';
}
})
}
})();
打开新页面无法完美处理,只能刷新解决
最开始的时候接触到vim,学习了好长时间,改了键位等等,但是最后还是死在了对vim的配置上面。
后来在VSCode里面使用vim键位,用了一段时间之后,发现打开文件的速度也太慢了,就放弃了vim。
想着不如直接学好VSCode自带的快捷键好了,于是乎开始深入学习VSCode,参照极客学院的VSCode教程。
直到现在,换上了VSCode的Neo Vim插件Neo Vim - Visual Studio Marketplace,打开速度可以接受,操作方法在Insert模式下与VSCode相互兼容,是一个很不错的选择。
updatetime: 2021年7月9日
path: C:\Users\vhxubo\AppData\Local\nvim\init.vim
" 配置插件
call plug#begin('~/AppData/Local/nvim/plugged')
Plug 'tpope/vim-surround'
Plug 'asvetliakov/vim-easymotion'
Plug 'vim-scripts/argtextobj.vim'
call plug#end()
" 配置输入法切换的能力
autocmd InsertLeave * :silent :!C:\\tools\\im-select.exe 1033 && C:\\tools\\im-select.exe 2052
" 公用剪贴板
set clipboard^=unnamed,unnamedplus
" 配置leader
let mapleader = "\<Space>"
" 取消双leader
" map <Leader> <Plug>(easymotion-prefix)
" 配置快速修复
nnoremap <Leader>. <Cmd>call VSCodeNotify('editor.action.quickFix')<CR>
" VSCode侧边栏
nnoremap <Leader>b <Cmd>call VSCodeNotify('workbench.action.toggleSidebarVisibility')<CR>
" 复制后高亮
augroup highlight_yank
autocmd!
au TextYankPost * silent! lua vim.highlight.on_yank()
augroup END
Ctrl+S
保存文件并退出insert模式 "macros": {
"saveAndEscapeNeovim": [
"workbench.action.files.save",
"vscode-neovim.escape"
]
}
{
"key": "ctrl+s",
"command": "macros.saveAndEscapeNeovim",
"when": "editorTextFocus && neovim.mode == insert"
}
CTRL + V
列选择
y yaw
daw
"0p
:nohlsearch
:noh
C:\tools
目录下C:\Users\vhxubo\AppData\Local\nvim\init.vim
添加如下配置autocmd InsertLeave * :silent :!C:\\tools\\im-select.exe 1033 && C:\\tools\\im-select.exe 2052
set clipboard^=unnamed,unnamedplus
使用VSCode的折叠快捷键,配合gj
gk
替代jk防止展开
Ctrl + Shift + [
折叠代码
Ctrl + Shift + ]
展开代码
vim-easymotion
" 配置leader为空格
let mapleader = "\<Space>"
" 取消双leader
map <Leader> <Plug>(easymotion-prefix)
<leader>-fw
寻找w
<leader>-w
对文本增加字符跳转前缀
Default Mapping | Details
---------------------|----------------------------------------------
<Leader>f{char} | Find {char} to the right. See |f|.
<Leader>F{char} | Find {char} to the left. See |F|.
<Leader>t{char} | Till before the {char} to the right. See |t|.
<Leader>T{char} | Till after the {char} to the left. See |T|.
<Leader>w | Beginning of word forward. See |w|.
<Leader>W | Beginning of WORD forward. See |W|.
<Leader>b | Beginning of word backward. See |b|.
<Leader>B | Beginning of WORD backward. See |B|.
<Leader>e | End of word forward. See |e|.
<Leader>E | End of WORD forward. See |E|.
<Leader>ge | End of word backward. See |ge|.
<Leader>gE | End of WORD backward. See |gE|.
<Leader>j | Line downward. See |j|.
<Leader>k | Line upward. See |k|.
<Leader>n | Jump to latest "/" or "?" forward. See |n|.
<Leader>N | Jump to latest "/" or "?" backward. See |N|.
<Leader>s | Find(Search) {char} forward and backward.
| See |f| and |F|.
gu
小写gU
大写The gu, gU, and ~ are case operators.
To lowercase, uppercase, or toggle-case:
- the whole line: guu, gUU, g~~
- a word: guw, gUw, g~w
- a word object: guiw, gUiw, g~iw
- the character under cursor: vu, vU, ~
:s/test/boo/g
替换此行中的test为boo:%s/test/bool/g
替换所有行的:5,12s/foo/bar/g
替换5到12行<C-p>
在代码补全窗口下等同于 Up
<C-n>
在代码补全窗口下等同于 Down
d
dd
dnw
y
yy
ynw
s
S
修改整行u
U
ctrl + r
.
gt
向后 gT
向前gh
p
P
o
O
gg -> v -> G
=
==
V -> mi/ma
可以进行多行注释Ctrl+f
Ctrl+e
Ctrl+b
Ctrl+y
r
替换一个词替换完之后立马恢复 R
替换多个词不自动返回s
修改几个 S
修改整行w
W
b
B
e
E
zz
置顶zt
置底zb
<
>
H
底行 L
在Windows下,nvim的配置文件在~/AppData/Local/nvim/init.vim
下,默认不存在,需要自己创建
plug.vim
放到~/AppData/Local/nvim/autoload/
下init.vim
call plug#begin('~/AppData/Local/nvim/plugged')
Plug 'tpope/vim-surround'
call plug#end()
:PlugInstall
删除一个配对符号 (delete a surrounding) ds
更改一个配对符号 (change a surrounding) cs
增加一个配对符号 (yank a surrounding) ys
在新的行增加一个配对符号并进行缩进 yS
在整行增加一个配对符号 yss
在整行增加一个配对符号,配对符号单独成行并进行缩进 ySs
Yss
在行选择中,S<div>
standard/standard: 🌟 JavaScript Style Guide, with linter & automatic code fixer
motdotla/dotenv: Loads environment variables from .env for nodejs projects.
sindresorhus/got: 🌐 Human-friendly and powerful HTTP request library for Node.js
axios/axios: Promise based HTTP client for the browser and node.js
git checkout -b dev
//or git checkout dev
// 查看分支
git branch
// 上传分支
git push origin HEAD -u
标签是 Git 中的概念,而 releases 则是 Github、码云等源码托管商所提供的更高层的概念。Git 本身是没有 releases 这个概念,只有 tag。两者之间的关系则是,release 基于 tag,为 tag 添加更丰富的信息,一般是编译好的文件。Git tag 和 GitHub releases - 蓝桥云课
https://git-scm.com/book/en/v2/Git-Basics-Tagging
git tag -a v1.0 -m "comment"
git tag v1.0
git tag -a v1.0 9fceb02
git tag -d v1.0
git push --tags
w2 start
在rules加入
127.0.0.1:3000 api.vhxubo.com
同时需要为浏览器设置8899
代理
项目在 build 时,webpack 中会有一个叫 productionSourceMap 的配置属性,设置成 fasle,项目在打包后就看不到源码目录结构
module.exports = {
productionSourceMap: false
};
部分页面只针对 cookies 进行验证,用户可以通过篡改 cookies 访问管理员页面
现在的前端框架全是通过API获得数据,如何记录用户登录状态? - 阿健大叔的回答 - 知乎
https://www.zhihu.com/question/301253397/answer/548334082
在Windows中需要对特殊符号进行转义,如"
需要用\"
替代,某些特殊符号需要使用^
设置请求方式,默认为 GET
$ curl -X POST http://localhost:3000/login
将cookies写入到文件
$ curl -c cookies.txt https://github.com
$ cat cookies.txt
设置Header
$ curl -H "content-type:application/json" https://github.com
如果传输的数据为json,记得设置header, "content-type:application/json"
设置POST数据请求体
$ curl -X POST http://localhost:3000/login -d '{"username":"vhxubo","password":"*****"}'
设置cookies
$ curl -b 'foo1=bar' -b 'foo2=baz' https://taobao.com
# 上面命令发送两个 Cookie。
$ curl -b cookies.txt https://www.taobao.com
# 上面命令读取本地文件 cookies.txt,里面是服务器设置的 Cookie(参见-c参数),将其发送到服务器。
文件--选项--高级--显示文档内容--字体替换
嵌入型的图片和字符类型相同,方便居中操作
Alt s p
可以对题注样式进行设置:
设置自动题注,可以选择
建议将样式基准改为:无样式。在默认样式上直接修改,不建议新建,否则题注前将无法自动引用章节号
全局西文字符:Times New Roman
全局中文字符:宋体
论文正文:宋体小四,单倍行距(有时为固定磅22/23)
使用定义新的多级列表功能增加自动编号
第 1 章 概述
1.1 项目介绍
1.1.1 应用场景
Insert
按键尾注后面加空白页的方法 - 百度文库
word操作技巧:有关脚注和尾注的使用方法 - 知乎
本科毕业论文引用参考文献是直接打出来[1]然后点上标,在文末列出参考文献,还是点引用插入尾注。? - 知乎
Zotero安装与使用简介 – 杰峰的博客
1,2,3...
,设置在节的结尾插入^e
为[^&]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.