UNPKG

2.79 kBMarkdownView Raw
1<img src="http://tinper.org/assets/images/kero.png" width="120" style="max-width:100%;"/>
2
3
4[![npm version](https://img.shields.io/npm/v/kero.svg)](https://www.npmjs.com/package/kero)
5[![Build Status](https://img.shields.io/travis/iuap-design/kero/master.svg)](https://travis-ci.org/iuap-design/kero)
6[![devDependency Status](https://img.shields.io/david/dev/iuap-design/kero.svg)](https://david-dm.org/iuap-design/kero#info=devDependencies)
7[![NPM downloads](http://img.shields.io/npm/dm/kero.svg?style=flat)](https://npmjs.org/package/kero)
8
9
10[中文文档](./README_CN.md)
11## Introduction
12[kero](http://tinper.org/dist/kero/index.html) is a front-end model framework,As a ` MVVM ` architecture ` Model ` layer, multidimensional data Model, provide the solution for complex enterprise applications business application scenario development problems。
13
14
15## Features
16
17* Abundant API
18* Multidimensional Data Model
19* Status identifier
20* Paging cache capacity
21* event trigger
22
23
24## Quickstart
25
26
27### Get kero
28
29- npm
30
31```
32npm install kero
33```
34* cdn
35```
36//design.yonyoucloud.com/static/kero/latest/kero.js
37```
38### Introducing kero
39
40- ES6
41```
42import { Datatable } from "kero"
43
44```
45* HTML
46
47```
48<!-- kero is dependent on knockout-->
49<script src="//design.yonyoucloud.com/static/knockout/knockout-3.2.0.debug.js"></script>
50<script src="//design.yonyoucloud.com/static/kero/latest/kero.js"></script>
51```
52
53### Use
54
55#### definition
56
57
58 var myDataTable = new u.DataTable({
59 meta:{
60 field1:{required:true},
61 field2:{}
62 }
63 })
64
65
66
67
68
69#### add data
70
71
72 dataTable.setSimpleData([
73 {"id": "001","name": "tom"},
74 {"id": "002","name": "john"}
75 ])
76
77
78
79#### setValue
80
81 var row = dataTable.createEmptyRow();
82 row.setValue('id','003')
83
84
85#### update
86
87 var row = dataTable.getRow(index);
88 row.setValue('name','jerry');
89
90
91#### delete
92
93 dataTable.removeRow(index);
94
95#### get all data
96
97 var json = dataTable.getSimpleData();
98
99#### add event trigger
100
101```
102dataTable1.on('valueChange',function(event){
103 var field = event.field,
104 rowId = event.rowId,
105 oldValue = event.oldValue,
106 newValue = event.newValue;
107});
108```
109
110Read the [Develop documentation](http://tinper.org/dist/kero/docs/overview.html) for information on the framework contents, templates and examples, and more.
111
112
113## Contributing
114
115### Develop
116
117Developers can participate in the development of kero, but also can be based on kero two development
118
119
120kero use gulp.js and webpack build the project.
121
122
123clone:
124
125```
126$ git clone git@github.com:iuap-design/kero.git
127```
128
129install:
130
131```
132$ npm install
133```
134
135build:
136
137```
138$ npm run product
139```
140
141### Feedback
142
143If you encounter any problems , submit [issues](https://github.com/iuap-design/kero/issues),or pull request。
144
145[PR code](CONTRIBUTING.md)
146
147
148## Licence 版权
149
150[MIT](./LICENSE)