forked from cuixiaorui/mini-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7135d68
commit 6e4911e
Showing
5 changed files
with
34 additions
and
3 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
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
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 |
---|---|---|
@@ -1 +1,24 @@ | ||
export * from "./shapeFlags"; | ||
|
||
const camelizeRE = /-(\w)/g; | ||
/** | ||
* @private | ||
* 把烤肉串命名方式转换成驼峰命名方式 | ||
*/ | ||
export const camelize = (str: string): string => { | ||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : "")); | ||
}; | ||
|
||
/** | ||
* @private | ||
* 首字母大写 | ||
*/ | ||
export const capitalize = (str: string) => | ||
str.charAt(0).toUpperCase() + str.slice(1); | ||
|
||
/** | ||
* @private | ||
* 添加 on 前缀,并且首字母大写 | ||
*/ | ||
export const toHandlerKey = (str: string) => | ||
str ? `on${capitalize(str)}` : ``; |