Skip to content

Commit

Permalink
0.2.1 继续修复ZLList(问题:使用默认构造函数创建时,多出一个undefined元素)
Browse files Browse the repository at this point in the history
  • Loading branch information
gm958spanda committed Jun 19, 2021
1 parent 5579bed commit a4020d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,6 @@ router.pushViewPage(OtherPage);
### 0.2.0
* 增加对css transition的支持
* 修复ZLList的protoltype问题 https://github.com/Microsoft/TypeScript/wiki/FAQ#why-doesnt-extending-built-ins-like-error-array-and-map-work
### 0.2.1
* 继续修复ZLList(问题:使用默认构造函数创建时,多出一个undefined元素)
2 changes: 1 addition & 1 deletion src/zlkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-zlview",
"version": "0.2.0",
"version": "0.2.1",
"description": "ZLView base react , super and sub , coordinate by x-y-width-height;基于react的视图,使用x-y-width-height坐标系",
"author": "zxs.zl",
"license": "MIT",
Expand Down
10 changes: 5 additions & 5 deletions src/zlkit/sugar/list.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export class ZLList<T> extends Array
{
constructor(arrayLength?:number)
constructor()
{
super(arrayLength);
super();
//https://github.com/Microsoft/TypeScript/wiki/FAQ#why-doesnt-extending-built-ins-like-error-array-and-map-work
Object.setPrototypeOf(this, ZLList.prototype);
if(arrayLength!== undefined && this.length === (arrayLength+1) ) {
this.pop() //移除
}
// if( this.length === 1 ) {
// this.pop() //移除
// }
}
/**
* 数组长度
Expand Down

0 comments on commit a4020d6

Please sign in to comment.