之所以要做这个页面的原因是这样的:
在看某番时看到了某场面后,笔记本随即就被水淹没。所幸最后抢救了回来。于是就觉得是时候把一些重要笔记誊写到云端了。(这网站做了自然也不能闲着,正好写点东西)


这就去和卡车对线

因本质是为自己做备份用,所以笔记中混杂着的中英文就不专门去翻译了。
一:好代码的标准

1.避免使用全局变量
2.将变量与函数名起的易于理解
3.函数单个模块代码小于100行
4.注意代码易读性,空格可以多用
5.统一代码风格,注释的重点是What to do而不是What is this
6.列出函数功能,有助于编辑帮助文档
7.避免使用过于多层的嵌套和继承
8.在reference中标出使用的插件和相关的Package
二:Some notes related to frontend develop
2.1:Typescript — Superset of JS (fit for modern big project and need to compile)
2.2:
V-bind : Bind with class/style
V-For:Render a list based on array. The array need to be determined in time.
{{item in items}}
V-on:Listen to the events on Dom
V-show:show the CSS conditionally different with the V-if. V-show is switch based on CSS, which will use lower time cost.
2.3:Non-Prop Attributes: Can be passed to a component, but doesn’t have a corresponding prop desined.
在组件内添加新属性可以被自动整合。$attrs :include the attribute in parent that’s not be defined (the attribute in $attrs can be disabled by inheriAttrs:false)
2.4:Events
2.4.1:V-model默认使用Value中的Prop和Input事件。
2.5:Slots:Add spaces in child component(compile in child scope) to contain the content from father component(complie in father scope).
2.6:”is” Used to switch between different components
2.7:Some notes related with Dynamic & Async components:
2.7.1:Use “Keep-alive” to keep needed components alive(动态组件可以被重复创建)
2.7.2:Async component can devide the app into smaller chunk and load only needed components.
2.8:Edge cases:
2.8.1:依赖注入:直接将方法导入实例,过度使用此方法将会让代码重构变的困难。
2.8.2:Use If to jump off the ∞
2.8.3:When “dead lock” situation happened: Use “beforeCreate” function to solve that.
2.8.4:V-Once Try not to use this
2.9: Lifestyle Hock:
beforeCreate -> Created -> beforeMount -> Mounted -> beforeUpdate -> Updated -> Activated -> deactivated -> beforeUnmount -> Unmounted -> errorCaptured
renderTracked(监视变化,用于调试和测试)
renderTriggered(监视单个变化)
3.Null 和 Undefined 是所有类型的子类型,而Void类型不能赋值给其他类型(虽然都没有明确指代而实际意义也欠缺)