feat: readme

This commit is contained in:
theajack 2021-04-17 18:47:07 +08:00
parent 921ac8d447
commit 35f1d3f02d
4 changed files with 137 additions and 91 deletions

167
README.md
View File

@ -3,15 +3,30 @@
</p>
<p align="center">
<a href="https://www.github.com/theajack/cnchar"><img src="https://img.shields.io/github/stars/theajack/cnchar.svg?style=social" alt="star"></a>
<a href="https://theajack.gitee.io"><img src="https://img.shields.io/badge/author-theajack-blue.svg?style=social" alt="Author"></a>
</p>
<a href="https://www.github.com/theajack/cnchar/stargazers" target="_black">
<img src="https://img.shields.io/github/stars/theajack/cnchar?logo=github" alt="stars" />
</a>
<a href="https://www.github.com/theajack/cnchar/network/members" target="_black">
<img src="https://img.shields.io/github/forks/theajack/cnchar?logo=github" alt="forks" />
</a>
<a href="https://www.npmjs.com/package/cnchar" target="_black">
<img src="https://img.shields.io/npm/v/cnchar?logo=npm" alt="version" />
</a>
<a href="https://www.npmjs.com/package/cnchar" target="_black">
<img src="https://img.shields.io/npm/dm/cnchar?color=%23ffca28&logo=npm" alt="downloads" />
</a>
<a href="https://www.jsdelivr.com/package/npm/cnchar" target="_black">
<img src="https://data.jsdelivr.com/v1/package/npm/cnchar/badge" alt="jsdelivr" />
</a>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/cnchar"><img src="https://img.shields.io/npm/v/cnchar.svg" alt="Version"></a>
<a href="https://npmcharts.com/compare/cnchar?minimal=true"><img src="https://img.shields.io/npm/dm/cnchar.svg" alt="Downloads"></a>
<a href="https://github.com/theajack" target="_black">
<img src="https://img.shields.io/badge/Author-%20theajack%20-7289da.svg?&logo=github" alt="author" />
</a>
<a href="https://www.github.com/theajack/cnchar/blob/master/LICENSE" target="_black">
<img src="https://img.shields.io/github/license/theajack/cnchar?color=%232DCE89&logo=github" alt="license" />
</a>
<a href="https://cdn.jsdelivr.net/gh/theajack/cnchar/dist/cnchar.latest.min.js"><img src="https://img.shields.io/bundlephobia/minzip/cnchar.svg" alt="Size"></a>
<a href="https://github.com/theajack/cnchar/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/cnchar.svg" alt="License"></a>
<a href="https://github.com/theajack/cnchar/search?l=javascript"><img src="https://img.shields.io/github/languages/top/theajack/cnchar.svg" alt="TopLang"></a>
<a href="https://github.com/theajack/cnchar/issues"><img src="https://img.shields.io/github/issues-closed/theajack/cnchar.svg" alt="issue"></a>
<a href="https://www.github.com/theajack/cnchar"><img src="https://img.shields.io/librariesio/dependent-repos/npm/cnchar.svg" alt="Dependent"></a>
@ -29,75 +44,75 @@
<!-- toc -->
- [前言](#%E5%89%8D%E8%A8%80)
- [0.快速使用](#0%E5%BF%AB%E9%80%9F%E4%BD%BF%E7%94%A8)
- [1.功能](#1%E5%8A%9F%E8%83%BD)
- [2.概览](#2%E6%A6%82%E8%A7%88)
- [3.安装](#3%E5%AE%89%E8%A3%85)
* [3.1 使用 npm 安装](#31-%E4%BD%BF%E7%94%A8-npm-%E5%AE%89%E8%A3%85)
* [3.2 cdn 引入](#32-cdn-%E5%BC%95%E5%85%A5)
- [4.使用](#4%E4%BD%BF%E7%94%A8)
* [4.1 webpack浏览器环境(有window对象)](#41-webpack%E6%B5%8F%E8%A7%88%E5%99%A8%E7%8E%AF%E5%A2%83%E6%9C%89window%E5%AF%B9%E8%B1%A1)
* [4.2 nodejs 等非浏览器环境](#42-nodejs-%E7%AD%89%E9%9D%9E%E6%B5%8F%E8%A7%88%E5%99%A8%E7%8E%AF%E5%A2%83)
* [4.3 原生浏览器环境](#43-%E5%8E%9F%E7%94%9F%E6%B5%8F%E8%A7%88%E5%99%A8%E7%8E%AF%E5%A2%83)
- [前言](#前言)
- [0.快速使用](#0快速使用)
- [1.功能](#1功能)
- [2.概览](#2概览)
- [3.安装](#3安装)
- [3.1 使用 npm 安装](#31-使用-npm-安装)
- [3.2 cdn 引入](#32-cdn-引入)
- [4.使用](#4使用)
- [4.1 webpack浏览器环境(有window对象)](#41-webpack浏览器环境有window对象)
- [4.2 nodejs 等非浏览器环境](#42-nodejs-等非浏览器环境)
- [4.3 原生浏览器环境](#43-原生浏览器环境)
- [5.API](#5api)
* [5.1 拼音笔画基础 API: spell & stroke](#51-%E6%8B%BC%E9%9F%B3%E7%AC%94%E7%94%BB%E5%9F%BA%E7%A1%80-api-spell--stroke)
* [5.2 可视化绘制汉字: draw](#52-%E5%8F%AF%E8%A7%86%E5%8C%96%E7%BB%98%E5%88%B6%E6%B1%89%E5%AD%97-draw)
+ [5.2.1 使用](#521-%E4%BD%BF%E7%94%A8)
+ [5.2.2 参数](#522-%E5%8F%82%E6%95%B0)
+ [5.2.3 微信小程序中使用](#523-%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E4%B8%AD%E4%BD%BF%E7%94%A8)
* [5.3 繁体、简体、火星文互转: convert](#53-%E7%B9%81%E4%BD%93%E7%AE%80%E4%BD%93%E7%81%AB%E6%98%9F%E6%96%87%E4%BA%92%E8%BD%AC-convert)
* [5.4 笔画序列推出原汉字: orderToWord](#54-%E7%AC%94%E7%94%BB%E5%BA%8F%E5%88%97%E6%8E%A8%E5%87%BA%E5%8E%9F%E6%B1%89%E5%AD%97-ordertoword)
* [5.5 通过拼音查询原汉字: spellToWord](#55-%E9%80%9A%E8%BF%87%E6%8B%BC%E9%9F%B3%E6%9F%A5%E8%AF%A2%E5%8E%9F%E6%B1%89%E5%AD%97-spelltoword)
* [5.6 通过笔画数查询原汉字: strokeToWord](#56-%E9%80%9A%E8%BF%87%E7%AC%94%E7%94%BB%E6%95%B0%E6%9F%A5%E8%AF%A2%E5%8E%9F%E6%B1%89%E5%AD%97-stroketoword)
* [5.7 成语功能](#57-%E6%88%90%E8%AF%AD%E5%8A%9F%E8%83%BD)
* [5.8 歇后语功能](#58-%E6%AD%87%E5%90%8E%E8%AF%AD%E5%8A%9F%E8%83%BD)
* [5.9 偏旁部首功能](#59-%E5%81%8F%E6%97%81%E9%83%A8%E9%A6%96%E5%8A%9F%E8%83%BD)
* [5.10 汉字、拼音工具方法](#510-%E6%B1%89%E5%AD%97%E6%8B%BC%E9%9F%B3%E5%B7%A5%E5%85%B7%E6%96%B9%E6%B3%95)
+ [5.10.1 查询拼音详细信息: spellInfo](#5101-%E6%9F%A5%E8%AF%A2%E6%8B%BC%E9%9F%B3%E8%AF%A6%E7%BB%86%E4%BF%A1%E6%81%AF-spellinfo)
+ [5.10.2 拼音音调操作: transformTone](#5102-%E6%8B%BC%E9%9F%B3%E9%9F%B3%E8%B0%83%E6%93%8D%E4%BD%9C-transformtone)
+ [5.10.3 是否是汉字: isCnChar](#5103-%E6%98%AF%E5%90%A6%E6%98%AF%E6%B1%89%E5%AD%97-iscnchar)
+ [5.10.4 是否是多音字: isPolyWord](#5104-%E6%98%AF%E5%90%A6%E6%98%AF%E5%A4%9A%E9%9F%B3%E5%AD%97-ispolyword)
+ [5.10.5 比较拼音(汉字)大小: compareSpell](#5105-%E6%AF%94%E8%BE%83%E6%8B%BC%E9%9F%B3%E6%B1%89%E5%AD%97%E5%A4%A7%E5%B0%8F-comparespell)
+ [5.10.6 比较汉字笔画数大小: compareStroke](#5106-%E6%AF%94%E8%BE%83%E6%B1%89%E5%AD%97%E7%AC%94%E7%94%BB%E6%95%B0%E5%A4%A7%E5%B0%8F-comparestroke)
+ [5.10.7 根据拼音排序: sortSpell](#5107-%E6%A0%B9%E6%8D%AE%E6%8B%BC%E9%9F%B3%E6%8E%92%E5%BA%8F-sortspell)
+ [5.10.8 根据笔画数排序: sortStroke](#5108-%E6%A0%B9%E6%8D%AE%E7%AC%94%E7%94%BB%E6%95%B0%E6%8E%92%E5%BA%8F-sortstroke)
+ [5.10.9 将数字表示的声调转为拼音声调: shapeSpell](#5109-%E5%B0%86%E6%95%B0%E5%AD%97%E8%A1%A8%E7%A4%BA%E7%9A%84%E5%A3%B0%E8%B0%83%E8%BD%AC%E4%B8%BA%E6%8B%BC%E9%9F%B3%E5%A3%B0%E8%B0%83-shapespell)
* [5.11 自定义数据](#511-%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE)
+ [5.11.1 setSpell](#5111-setspell)
+ [5.11.2 setSpellDefault](#5112-setspelldefault)
+ [5.11.3 setStrokeCount](#5113-setstrokecount)
+ [5.11.4 setPolyPhrase](#5114-setpolyphrase)
+ [5.11.5 setOrder](#5115-setorder)
+ [5.11.6 setRadical](#5116-setradical)
+ [5.11.7 addXhy](#5117-addxhy)
* [5.12 其他 api](#512-%E5%85%B6%E4%BB%96-api)
+ [5.12.1 .use()](#5121-use)
+ [5.12.2 .type](#5122-type)
+ [5.12.3 .check](#5123-check)
+ [5.12.4 .version](#5124-version)
+ [5.12.5 .plugins](#5125-plugins)
- [6.参数介绍](#6%E5%8F%82%E6%95%B0%E4%BB%8B%E7%BB%8D)
* [6.1 spell 参数](#61-spell-%E5%8F%82%E6%95%B0)
* [6.2 stroke 参数](#62-stroke-%E5%8F%82%E6%95%B0)
* [6.3 orderToWord 参数](#63-ordertoword-%E5%8F%82%E6%95%B0)
* [6.4 spellToWord 参数](#64-spelltoword-%E5%8F%82%E6%95%B0)
* [6.5 strokeToWord 参数](#65-stroketoword-%E5%8F%82%E6%95%B0)
* [6.6 idiom 参数](#66-idiom-%E5%8F%82%E6%95%B0)
* [6.7 xhy 参数](#67-xhy-%E5%8F%82%E6%95%B0)
* [6.8 radical 参数](#68-radical-%E5%8F%82%E6%95%B0)
* [6.9 使用实例大全:](#69-%E4%BD%BF%E7%94%A8%E5%AE%9E%E4%BE%8B%E5%A4%A7%E5%85%A8)
+ [6.9.0 安装使用](#690-%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8)
+ [6.9.1 cnchar 基础库功能](#691-cnchar-%E5%9F%BA%E7%A1%80%E5%BA%93%E5%8A%9F%E8%83%BD)
+ [6.9.2 cnchar-poly 库功能](#692-cnchar-poly-%E5%BA%93%E5%8A%9F%E8%83%BD)
+ [6.9.3 cnchar-order 库功能](#693-cnchar-order-%E5%BA%93%E5%8A%9F%E8%83%BD)
+ [6.9.4 cnchar-trad 库功能](#694-cnchar-trad-%E5%BA%93%E5%8A%9F%E8%83%BD)
- [6.9.4.1 convert 字体转换](#6941-convert-%E5%AD%97%E4%BD%93%E8%BD%AC%E6%8D%A2)
- [6.9.4.2 spell 和 stroke 方法](#6942-spell-%E5%92%8C-stroke-%E6%96%B9%E6%B3%95)
+ [6.9.5 cnchar-idiom 库功能](#695-cnchar-idiom-%E5%BA%93%E5%8A%9F%E8%83%BD)
+ [6.9.6 cnchar-xhy 库功能](#696-cnchar-xhy-%E5%BA%93%E5%8A%9F%E8%83%BD)
+ [6.9.7 cnchar-radical 库功能](#697-cnchar-radical-%E5%BA%93%E5%8A%9F%E8%83%BD)
+ [6.9.8 工具方法](#698-%E5%B7%A5%E5%85%B7%E6%96%B9%E6%B3%95)
- [5.1 拼音笔画基础 API: spell & stroke](#51-拼音笔画基础-api-spell--stroke)
- [5.2 可视化绘制汉字: draw](#52-可视化绘制汉字-draw)
- [5.2.1 使用](#521-使用)
- [5.2.2 参数](#522-参数)
- [5.2.3 微信小程序中使用](#523-微信小程序中使用)
- [5.3 繁体、简体、火星文互转: convert](#53-繁体简体火星文互转-convert)
- [5.4 笔画序列推出原汉字: orderToWord](#54-笔画序列推出原汉字-ordertoword)
- [5.5 通过拼音查询原汉字: spellToWord](#55-通过拼音查询原汉字-spelltoword)
- [5.6 通过笔画数查询原汉字: strokeToWord](#56-通过笔画数查询原汉字-stroketoword)
- [5.7 成语功能](#57-成语功能)
- [5.8 歇后语功能](#58-歇后语功能)
- [5.9 偏旁部首功能](#59-偏旁部首功能)
- [5.10 汉字、拼音工具方法](#510-汉字拼音工具方法)
- [5.10.1 查询拼音详细信息: spellInfo](#5101-查询拼音详细信息-spellinfo)
- [5.10.2 拼音音调操作: transformTone](#5102-拼音音调操作-transformtone)
- [5.10.3 是否是汉字: isCnChar](#5103-是否是汉字-iscnchar)
- [5.10.4 是否是多音字: isPolyWord](#5104-是否是多音字-ispolyword)
- [5.10.5 比较拼音(汉字)大小: compareSpell](#5105-比较拼音汉字大小-comparespell)
- [5.10.6 比较汉字笔画数大小: compareStroke](#5106-比较汉字笔画数大小-comparestroke)
- [5.10.7 根据拼音排序: sortSpell](#5107-根据拼音排序-sortspell)
- [5.10.8 根据笔画数排序: sortStroke](#5108-根据笔画数排序-sortstroke)
- [5.10.9 将数字表示的声调转为拼音声调: shapeSpell](#5109-将数字表示的声调转为拼音声调-shapespell)
- [5.11 自定义数据](#511-自定义数据)
- [5.11.1 setSpell](#5111-setspell)
- [5.11.2 setSpellDefault](#5112-setspelldefault)
- [5.11.3 setStrokeCount](#5113-setstrokecount)
- [5.11.4 setPolyPhrase](#5114-setpolyphrase)
- [5.11.5 setOrder](#5115-setorder)
- [5.11.6 setRadical](#5116-setradical)
- [5.11.7 addXhy](#5117-addxhy)
- [5.12 其他 api](#512-其他-api)
- [5.12.1 .use()](#5121-use)
- [5.12.2 .type](#5122-type)
- [5.12.3 .check](#5123-check)
- [5.12.4 .version](#5124-version)
- [5.12.5 .plugins](#5125-plugins)
- [6.参数介绍](#6参数介绍)
- [6.1 spell 参数](#61-spell-参数)
- [6.2 stroke 参数](#62-stroke-参数)
- [6.3 orderToWord 参数](#63-ordertoword-参数)
- [6.4 spellToWord 参数](#64-spelltoword-参数)
- [6.5 strokeToWord 参数](#65-stroketoword-参数)
- [6.6 idiom 参数](#66-idiom-参数)
- [6.7 xhy 参数](#67-xhy-参数)
- [6.8 radical 参数](#68-radical-参数)
- [6.9 使用实例大全:](#69-使用实例大全)
- [6.9.0 安装使用](#690-安装使用)
- [6.9.1 cnchar 基础库功能](#691-cnchar-基础库功能)
- [6.9.2 cnchar-poly 库功能](#692-cnchar-poly-库功能)
- [6.9.3 cnchar-order 库功能](#693-cnchar-order-库功能)
- [6.9.4 cnchar-trad 库功能](#694-cnchar-trad-库功能)
- [6.9.4.1 convert 字体转换](#6941-convert-字体转换)
- [6.9.4.2 spell 和 stroke 方法](#6942-spell-和-stroke-方法)
- [6.9.5 cnchar-idiom 库功能](#695-cnchar-idiom-库功能)
- [6.9.6 cnchar-xhy 库功能](#696-cnchar-xhy-库功能)
- [6.9.7 cnchar-radical 库功能](#697-cnchar-radical-库功能)
- [6.9.8 工具方法](#698-工具方法)
- [6.9.8.1 spellInfo](#6981-spellinfo)
- [6.9.8.2 isCnChar](#6982-iscnchar)
- [6.9.8.3 transformTone](#6983-transformtone)
@ -114,7 +129,7 @@
- [6.9.8.14 setPolyPhrase](#69814-setpolyphrase)
- [6.9.8.15 setRadical](#69815-setradical)
- [6.9.8.16 addXhy](#69816-addxhy)
- [7.应用例子](#7%E5%BA%94%E7%94%A8%E4%BE%8B%E5%AD%90)
- [7.应用例子](#7应用例子)
<!-- tocstop -->

View File

@ -3,15 +3,30 @@
</p>
<p align="center">
<a href="https://www.github.com/theajack/cnchar"><img src="https://img.shields.io/github/stars/theajack/cnchar.svg?style=social" alt="star"></a>
<a href="https://theajack.gitee.io"><img src="https://img.shields.io/badge/author-theajack-blue.svg?style=social" alt="Author"></a>
</p>
<a href="https://www.github.com/theajack/cnchar/stargazers" target="_black">
<img src="https://img.shields.io/github/stars/theajack/cnchar?logo=github" alt="stars" />
</a>
<a href="https://www.github.com/theajack/cnchar/network/members" target="_black">
<img src="https://img.shields.io/github/forks/theajack/cnchar?logo=github" alt="forks" />
</a>
<a href="https://www.npmjs.com/package/cnchar" target="_black">
<img src="https://img.shields.io/npm/v/cnchar?logo=npm" alt="version" />
</a>
<a href="https://www.npmjs.com/package/cnchar" target="_black">
<img src="https://img.shields.io/npm/dm/cnchar?color=%23ffca28&logo=npm" alt="downloads" />
</a>
<a href="https://www.jsdelivr.com/package/npm/cnchar" target="_black">
<img src="https://data.jsdelivr.com/v1/package/npm/cnchar/badge" alt="jsdelivr" />
</a>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/cnchar"><img src="https://img.shields.io/npm/v/cnchar.svg" alt="Version"></a>
<a href="https://npmcharts.com/compare/cnchar?minimal=true"><img src="https://img.shields.io/npm/dm/cnchar.svg" alt="Downloads"></a>
<a href="https://github.com/theajack" target="_black">
<img src="https://img.shields.io/badge/Author-%20theajack%20-7289da.svg?&logo=github" alt="author" />
</a>
<a href="https://www.github.com/theajack/cnchar/blob/master/LICENSE" target="_black">
<img src="https://img.shields.io/github/license/theajack/cnchar?color=%232DCE89&logo=github" alt="license" />
</a>
<a href="https://cdn.jsdelivr.net/gh/theajack/cnchar/dist/cnchar.latest.min.js"><img src="https://img.shields.io/bundlephobia/minzip/cnchar.svg" alt="Size"></a>
<a href="https://github.com/theajack/cnchar/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/cnchar.svg" alt="License"></a>
<a href="https://github.com/theajack/cnchar/search?l=javascript"><img src="https://img.shields.io/github/languages/top/theajack/cnchar.svg" alt="TopLang"></a>
<a href="https://github.com/theajack/cnchar/issues"><img src="https://img.shields.io/github/issues-closed/theajack/cnchar.svg" alt="issue"></a>
<a href="https://www.github.com/theajack/cnchar"><img src="https://img.shields.io/librariesio/dependent-repos/npm/cnchar.svg" alt="Dependent"></a>

View File

@ -3,15 +3,30 @@
</p>
<p align="center">
<a href="https://www.github.com/theajack/cnchar"><img src="https://img.shields.io/github/stars/theajack/cnchar.svg?style=social" alt="star"></a>
<a href="https://theajack.gitee.io"><img src="https://img.shields.io/badge/author-theajack-blue.svg?style=social" alt="Author"></a>
</p>
<a href="https://www.github.com/theajack/cnchar/stargazers" target="_black">
<img src="https://img.shields.io/github/stars/theajack/cnchar?logo=github" alt="stars" />
</a>
<a href="https://www.github.com/theajack/cnchar/network/members" target="_black">
<img src="https://img.shields.io/github/forks/theajack/cnchar?logo=github" alt="forks" />
</a>
<a href="https://www.npmjs.com/package/cnchar" target="_black">
<img src="https://img.shields.io/npm/v/cnchar?logo=npm" alt="version" />
</a>
<a href="https://www.npmjs.com/package/cnchar" target="_black">
<img src="https://img.shields.io/npm/dm/cnchar?color=%23ffca28&logo=npm" alt="downloads" />
</a>
<a href="https://www.jsdelivr.com/package/npm/cnchar" target="_black">
<img src="https://data.jsdelivr.com/v1/package/npm/cnchar/badge" alt="jsdelivr" />
</a>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/cnchar"><img src="https://img.shields.io/npm/v/cnchar.svg" alt="Version"></a>
<a href="https://npmcharts.com/compare/cnchar?minimal=true"><img src="https://img.shields.io/npm/dm/cnchar.svg" alt="Downloads"></a>
<a href="https://github.com/theajack" target="_black">
<img src="https://img.shields.io/badge/Author-%20theajack%20-7289da.svg?&logo=github" alt="author" />
</a>
<a href="https://www.github.com/theajack/cnchar/blob/master/LICENSE" target="_black">
<img src="https://img.shields.io/github/license/theajack/cnchar?color=%232DCE89&logo=github" alt="license" />
</a>
<a href="https://cdn.jsdelivr.net/gh/theajack/cnchar/dist/cnchar.latest.min.js"><img src="https://img.shields.io/bundlephobia/minzip/cnchar.svg" alt="Size"></a>
<a href="https://github.com/theajack/cnchar/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/cnchar.svg" alt="License"></a>
<a href="https://github.com/theajack/cnchar/search?l=javascript"><img src="https://img.shields.io/github/languages/top/theajack/cnchar.svg" alt="TopLang"></a>
<a href="https://github.com/theajack/cnchar/issues"><img src="https://img.shields.io/github/issues-closed/theajack/cnchar.svg" alt="issue"></a>
<a href="https://www.github.com/theajack/cnchar"><img src="https://img.shields.io/librariesio/dependent-repos/npm/cnchar.svg" alt="Dependent"></a>

View File

@ -42,5 +42,6 @@
"厕": "cè",
"免": "miǎn",
"倘": "tǎng",
"张": "zhāng"
"张": "zhāng",
"哦": "ó"
}