galenjiang's recent timeline updates
galenjiang

galenjiang

V2EX member #514839, joined on 2020-10-27 17:20:35 +08:00
galenjiang's recent replies
Apr 27, 2025
Replied to a topic by lyt001 生活 穷鬼为什么要生孩子?
你的父母你是没法选择的。
但你的孩子的父母,你可以选择。
可以试试让你的孩子重过你这一生,这样多一点原谅。
Apr 5, 2025
Replied to a topic by quqiu macOS macos 如何做快捷键映射?
aaaaaaaa
Apr 5, 2025
Replied to a topic by quqiu macOS macos 如何做快捷键映射?
我的建议是,只要用 spotlight 或者同样的工具就行,不要背快捷键。编辑器里面同样也有相似的工具,记一下对应的就行。
编辑操作的话记一下,control + a 行首, + e 行尾, + f 前一个字母, + b 后一个字母就行,顶多再用 opt + f, +b 设个下一个词,上一个词
有条件买个 hhkb,打字方便很多。
尽量把大脑中的空间留给思考,而不是背快捷键,提高操作速度。
Mar 29, 2025
Replied to a topic by momowei 程序员 为啥国内对阿里轮子似乎嘲讽居多
@wangtian2020 算我没了解阿里贡献了哪个规范,我可以不说话,但是人家问你的,你怎么不回?
Mar 25, 2025
Replied to a topic by momowei 程序员 为啥国内对阿里轮子似乎嘲讽居多
@wangtian2020 不 care 还是 catch?😂Lmao
Mar 5, 2025
Replied to a topic by sngxx git 请教一个开发流程中 GIT 解决冲突的问题
假如用了 gitlab 或者 GitHub 冲突了,会有提示,按照提示操作就是最佳的方案。
Mar 5, 2025
Replied to a topic by sngxx git 请教一个开发流程中 GIT 解决冲突的问题
唯一的区别是生成下个 commit 记录的 first parent commit 是 master 上的最后一个 commit 还是 feature 上的最后一个 commit.用了 fast forward merge 就是没有区别
Feb 27, 2025
Replied to a topic by baizhu 程序员 如何可以持续提升自己的编程能力
接受自己的无能,会让自己精神不至于变更糟。
Feb 2, 2025
Replied to a topic by llej 程序员 对于依赖注入的思考-二
@llej 我大概明白了,vue 其实是在生成实例时把,把当前实例存在全局变量中,异步是没法通过 getCurrentInstance 访问这个变量的,所以 inject 是依赖 setup ,但是 setup 并没有显式声明这个 this ,所以这里 inject 破坏了依赖注入,使用了一个外部变量
解决的办法是重写 function inject(key, defaultValue) {
let instance = getCurrentInstance(); // 获取当前组件实例
while (instance) {
if (instance.provides && key in instance.provides) {
return instance.provides[key]; // 找到并返回
}
instance = instance.parent; // 继续向上查找
}
return defaultValue; // 未找到,返回默认值
}把 getCurrentInstance 作为一个参数变量传入,而不是直接用全局变量。
Feb 2, 2025
Replied to a topic by llej 程序员 对于依赖注入的思考-二
@llej 我不太懂,为什么不能用 setTimeout 中使用 inject ,我好久没写了,印象中好像是可以的。还有为什么 useConfig 很难,异步你可以把它作为一个函数 cont useConfig=()=>inject("getConfig"), const getConfig = useConfig(); const config = getConfig()不就好了嘛, 或者 config 直接是一个 promise 都可以 。
meta data 是很优雅的,https://angular.dev/guide/di/dependency-injection#injecting-consuming-a-dependency ,其实它和 inject 可以是等价的。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   928 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 18:46 · PVG 02:46 · LAX 11:46 · JFK 14:46
♥ Do have faith in what you're doing.