https://github.com/shalldie/chuncai
A lovely Page Wizard, is responsible for selling moe.
https://github.com/shalldie/chuncai
chuncai moe
Last synced: 7 months ago
JSON representation
A lovely Page Wizard, is responsible for selling moe.
- Host: GitHub
- URL: https://github.com/shalldie/chuncai
- Owner: shalldie
- License: mit
- Created: 2016-03-08T07:50:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-13T06:38:22.000Z (over 7 years ago)
- Last Synced: 2025-03-11T10:41:21.654Z (7 months ago)
- Topics: chuncai, moe
- Language: TypeScript
- Homepage:
- Size: 236 KB
- Stars: 111
- Watchers: 8
- Forks: 35
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chuncai
[](https://www.npmjs.com/package/chuncai) 
A lovely Page Wizard, is responsible for selling moe...
一个可爱的页面导航精灵,负责卖萌。

[github: https://github.com/shalldie/chuncai](https://github.com/shalldie/chuncai)
[查看 demo](https://shalldie.github.io/demos/chuncai/index.html)
## Installation
npm install chuncai
## Usage & Example
调用 **init** 方法初始化。
**chuncai.init(opt:IOpt)**- **words** 是一个数组: **Array**,存放春菜闲暇时候说的话。
- **menu** 是菜单: _IOpt_,其中:1. **object** 表示子菜单
2. key **$title** 是在展开子菜单的时候,春菜要说的话
3. **string** 表示点击后要说的话
4. **Function** 是点击后要执行的方法可查看如下 example 和 interface 。
```js
// es module、typescript
import chuncai from 'chuncai';
// commonjs
//let chuncai = require('chuncai');
// window
//var chuncai = window['chuncai'];const opt = {
menu: {
$title: '一级菜单的标题',
'点击会执行方法': function () {
alert('hello chuncai');
},
'点击会说出一段话': 'balabalabalabalabala......',
'点击展开二级菜单': {
$title: '二级菜单的标题',
'选项1': '',
'选项2': function() {},
'三级菜单': {...}
},
'隐藏春菜': function () {
chuncai.hide();
}
},
words: [
'咦你想做什么 oAo',
'balabalabala...',
...
]
};chuncai.init(opt);
```## Interface
```js
/**
* 初始化参数
*
* @export
* @interface IOpt
*/
export interface IOpt {
/**
* 菜单
*
* @type {IMenuItem}
* @memberof IOpt
*/
menu: IMenuItem;
/**
* 随机语句
*
* @type {Array}
* @memberof IOpt
*/
words: Array;
}/**
* 菜单项
*
* @export
* @interface IMenuItem
*/
export interface IMenuItem {
/**
* 展开菜单时,陈述的文字
*
* @type {string}
* @memberof IMenuItem
*/
$title?: string;/**
* 点击每一项菜单时,进行的操作
* string - 陈述文字
* Function - 执行回调方法
* ImenuItem - 子菜单
*
* @type {string|Function|IMenuItem}
* @memberof IMenuItem
*/
[prop: string]: string | Function | IMenuItem;
}
```## >\_<#@! Enjoy.