-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Showing
97 changed files
with
10,602 additions
and
799 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## 1. 介绍 | ||
|
||
cnchar在2.2.5加入了偏旁部首功能,启用该功能需要安装 `cnchar-radical` 功能库,该库可以独立于cnchar主库运行 | ||
|
||
感谢 `kewell-tsao` 提供的 pr | ||
|
||
使用方式如下: | ||
|
||
```ts | ||
cnchar.radical(text:string | Array<string>, ...radicalArgs: Array<radicalArg>): string | Array<string>; | ||
``` | ||
|
||
看一个具体例子 | ||
|
||
```js | ||
cnchar.radical('你'); // "亻", | ||
cnchar.radical('你好呀'); // "亻女口" | ||
// 返回数组 | ||
cnchar.radical('你好呀', 'array'); // ["亻", "女", "口"] | ||
// 传入数组会默认返回数组 | ||
cnchar.radical(["你", "好", "呀"]); // ["亻", "女", "口"] | ||
``` | ||
|
||
使用cdn引用时,会在window对向上暴露 `CncharRadical` 对象 | ||
|
||
## 2. radical 参数 | ||
|
||
参数调用如下,value表示需要查询偏旁的汉字,可以是字符串或数组 | ||
|
||
```js | ||
cnchar.radical(value,arg1,arg2,...); | ||
``` | ||
|
||
| 参数 | 作用 | 是否默认 | 依赖库 | 备注 | | ||
| :-----: | :----: | :------: | :---: | :---: | | ||
| array | 是否返回数组 | 否 | -- | 当传入为数组时默认返回数组 | | ||
|
||
## 3. 实例 | ||
|
||
|
||
该库为cnchar扩展了偏旁部首功能 | ||
|
||
```js | ||
cnchar.radical('你'); // "亻", | ||
cnchar.radical('你好呀'); // "亻女口" | ||
cnchar.radical('你好呀', 'array'); // ["亻", "女", "口"] | ||
cnchar.radical(["你", "好", "呀"]); // ["亻", "女", "口"] | ||
``` |
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
2 changes: 1 addition & 1 deletion
2
docs/v2/assets/js/10.6fe8a37b.js → docs/v2/assets/js/10.35940bd6.js
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.