var DragOp = function() {}; DragOp.prototype = { start: function(){}, drag: function(){}, end: function(){}, isSameItem: function() { return false; } }; var SlideDrag = function(opts) { this.dragThresholdX = opts.dragThresholdX || 10; this.el = opts.el; this.item = opts.item; this.canSwipe = opts.canSwipe; }; SlideDrag.prototype = new DragOp();
這段話怎么理解,又是new又是prototype,搞懵 了,為啥這么寫呢?
至尊寶的傳說
2018-07-09 16:09:14