-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 编译uvue.runtime时替换@vue/shared的isIntegerKey
- Loading branch information
Showing
7 changed files
with
233 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ | |
"@babel/core": "^7.23.3", | ||
"@babel/parser": "^7.23.9", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/generator": "^7.25.6", | ||
"@dcloudio/types": "3.4.14", | ||
"@dcloudio/uni-api": "workspace:*", | ||
"@dcloudio/uni-app": "workspace:*", | ||
|
@@ -117,4 +118,4 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"name": "uni-app-next" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './utils' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const isStringIntegerKey = (key: unknown) => | ||
typeof key === 'string' && | ||
key !== 'NaN' && | ||
key[0] !== '-' && | ||
'' + parseInt(key, 10) === key | ||
|
||
const isNumberIntegerKey = (key: unknown) => | ||
typeof key === 'number' && | ||
!isNaN(key) && | ||
key >= 0 && | ||
parseInt(key + '', 10) === key | ||
|
||
/** | ||
* 用于替代@vue/shared的isIntegerKey,原始方法在鸿蒙arkts中会引发bug。根本原因是arkts的数组的key是数字而不是字符串。 | ||
* 目前这个方法使用的地方都和数组有关,切记不能挪作他用。 | ||
* @param key | ||
* @returns | ||
*/ | ||
export const isIntegerKey = (key: unknown) => | ||
isNumberIntegerKey(key) || isStringIntegerKey(key) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.