add table components - #6
Conversation
| return ( | ||
| <Table | ||
| gridManagerName={gridManagerName} | ||
| ajax_data='http://www.lovejavascript.com/blogManager/getBlogList' |
There was a problem hiding this comment.
api的风格都统一成一种风格吧,ajax_data=>ajaxData...
There was a problem hiding this comment.
ajax_*API是否可以合并一下?比如传一个resource、 promise...就可以
There was a problem hiding this comment.
在React版本中,除特殊情况。
仅会使用到ajax_data,其它的是应用于特殊情况,并非常用项。
There was a problem hiding this comment.
我们正常的使用方式,应该是如下:
ajax_data: () => {
return promise; // 这里返回一个promise,或await
}| render() { | ||
| return ( | ||
| <Table | ||
| gridManagerName={gridManagerName} |
There was a problem hiding this comment.
gridManagerName这个参数不传是否可以正常工作呢,如果这个字段在外面没有什么其他操作的话,可以在内部生成一个唯一的
There was a problem hiding this comment.
可以在组件内部去创建一个唯一的name,如果外面传进来了,那么使用外面传进来的,一般情况下外面传进来可能是因为页面纯在多分表格,然后有一些操作,纯展示的表格我认为是不需要传name的
There was a problem hiding this comment.
是否可以把gridManagerName封装到Table内部呢
| | isCombSorting | 用于配置是否使用组合排序功能| boolean | false | | ||
| | mergeSort | 配置是否合并排序字段| boolean | false | | ||
| | sortKey | ajax请求中排序字段所使用的前缀| string | 'sort_' | | ||
|
|
There was a problem hiding this comment.
可以考虑把 refreshGrid方法帮到Table上,比如 Table.refreshGrid(...),这样Table更像一个比较封闭的组件,而不是需要借助Table组件之外的其他方法/服务
There was a problem hiding this comment.
目前是支持这种形式的, 共有两种调用方式。如下:
import Table, {$gridManager} from '/xxx/table';
Table. refreshGrid(...) or gridManager. refreshGrid(...) There was a problem hiding this comment.
建议只暴露一种方式,不暴露多种使用方式,既然两种效果是一样的,那么保留一种就好,然后API文档上注明这个服务的作用和使用方式
There was a problem hiding this comment.
Table为react对像,$gridManager为原生对像。
现在是仅将Table爆露
| @@ -0,0 +1,87 @@ | |||
| /* eslint-disable */ | |||
There was a problem hiding this comment.
已引入了eslint-import-resolver-webpack进行了处理
| // 组件: 标题 | ||
| function TitleComponents(props) { | ||
| return ( | ||
| <a href={'https://www.lovejavascript.com/#!zone/blog/content.html?id=' + props.row.id} target={'_black'}>{props.row.title}</a> |
There was a problem hiding this comment.
这个需要调整eslint规则,现有eslint规则中markdown不能使用模板字符串。
| {index} - 快速、灵活的对Table标签进行实例化,让Table标签充满活力。该项目已开源, | ||
| <a target="_blank" href="https://github.com/baukh789/GridManager">点击进入</a> | ||
| github | ||
| </div> |
|
|
||
| .table-wrap.ccms-skin, | ||
| .table-wrap.ccms-skin.icon-follow-text { | ||
| .table-header{ |
There was a problem hiding this comment.
index.less多处类名与{空格问题需要调整
| @table-header-color: #F1F1F1; | ||
| @table-border: 1px solid #EEEEEE; | ||
| @sort-action-color: #ccc; | ||
| @sort-action-color-hover: #0083BA; |


1、增加table组件;2、修改webpack.config中loader的范围