路由
浏览器
点击github 仓库里面 readme 里面的标题前方的链接icon的时候
url会静默的改变。而整个页面不会刷新。
跟ai学了一下 在此记录一下
核心是 History Api
// 添加参数而不刷新页面
function addParamSilently(param, value) {
const url = new URL(window.location.href);
url.searchParams.set(param, value);
// 修改URL而不刷新页面
window.history.replaceState(null, '', url.toString());
}
// 使用示例
addParamSilently('tab', 'readme-ov-file');后续又问了一下 vue 如何监听这个params的变化 才知道
const route = useRoute()
// 这个route 是一个reactive包裹的对象
console.log(isReactive(route)) // true
console.log(isReactive(route.query)) // true
// 所以可以直接使用 watch watchEffect computed 进行实时监听。github
github ssh clone 拉代码的时候 发现 github 不可以使用账号密码进行clone了 所以在此记录一下通过ssh clone方法
1. 生成 SSH 密钥
ssh-keygen -t ed25519 -C "your_email@example.com"
# 按回车接受默认位置和空密码2. 添加 SSH 密钥到 GitHub
# 复制公钥内容
cat ~/.ssh/id_ed25519.pub
# 添加到 GitHub → Settings → SSH and GPG keys
# https://github.com/settings/keys3. 修改远程仓库地址为 SSH
git remote set-url origin git@github.com:appleeate/my-finance-app.git然后就可以了