Lei Zhang

还没入门

mapState、mapMutations、mapAction的理解

当一个组件需要获取多个状态时候,将这些状态都声明为计算属性会有些重复和冗余。为了解决这个问题,我们可以使用 mapState 辅助函数帮助我们生成计算属性。 官方文档中的说明: mapState mapState(namespace?: string, map: Array<string..


JavaScript: 原型链与继承

原型链的基本思想是:利用原型让一个引用类型继承另一个引用类型的属性和方法。重写或添加方法的正确写法:function SuperType() { this.property = true;}SuperType.prototype.getSuperValue = func..


JavaScript: 数据类型的转换

(只记录易错转换) 一、 强制转换1. Number()(1) 原始类型值// 字符串:如果不可以被解析为数值,返回 NaNNumber('324abc') // NaN// 字符串:如果不可以被解析为数值,返回 NaNNumber('324abc') ..


Vue: Caveats for list rendering

Due to limitations in JavaScript, Vue cannot detect the following changes to an array: When you directly set an item with the index, e.g. vm.items[..


Vue: v-if, v-show and v-for

v-if vs v-showV-if is “real” and lazy: The event and child components inside the conditional block are properly destroyed and re-created during the..


Vue:Computed Properties vs Methods

In the most cases, their performances are the same. However, in some instances just like: computed: { now: function(){ return Date.now();..