/avatar.png

Vuejs 笔记

计算属性和方法的区别

计算属性是基于它们的响应式依赖进行缓存的,只在相关响应式依赖发生改变时它们才会重新求值,如下示例,因为 Date.now() 不是响应式依赖,所以下面的计算属性不再更新:

夏令时切换时间如何计算

夏令时切换场景

在有些国家会存在夏令时切换的情况,当这种情况出现时会凭空的多出或少去一个小时,这种情况我们的程序是如何处理?又是如何计算时常的呢?

我们以墨西哥城的时间为例:

Azure DevOps 踩坑

让 .netCore 2.0 的测试在 Azure DevOps 中正确运行需要注意几个地方

  • 要增加 .netCore 的测试程序集目录;

https://cdn.jsdelivr.net/gh/fengrui358/img@main/282687-20180106102814362-1931048116.png
img

  • 设置 Speceific location:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform 设置 Other console options:/Framework:".NETCoreApp,Version=v2.0"

https://cdn.jsdelivr.net/gh/fengrui358/img@main/282687-20180106102836815-515444835.png
img

Javascript 笔记

类库

  • lodash:是一个通过 Lodash 限制操作频率的函数。
  • axios: Ajax 库。

代码片段

查看对象类型

使用 Object.prototype.toString 方法,通过第二个参数返回的构造函数判断对象类型

1
2
3
4
5
6
7
8
Object.prototype.toString.call(2); // "[object Number]"
Object.prototype.toString.call(""); // "[object String]"
Object.prototype.toString.call(true); // "[object Boolean]"
Object.prototype.toString.call(undefined); // "[object Undefined]"
Object.prototype.toString.call(null); // "[object Null]"
Object.prototype.toString.call(Math); // "[object Math]"
Object.prototype.toString.call({}); // "[object Object]"
Object.prototype.toString.call([]); // "[object Array]"

JavaScript 对象的元属性

1
2
3
4
5
6
7
8
{
  value: 123,
  writable: false,
  enumerable: true,
  configurable: false,
  get: undefined,
  set: undefined
}

将类似于数组的对象转换为数组

slice() 方法的一个重要应用,是将类似数组的对象转为真正的数组。