Skip to content

Commit f5b7d74

Browse files
authored
Merge pull request #27 from kne-union/linzp
添加format转义
2 parents fc03bc7 + 6777d57 commit f5b7d74

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ const columns = [{
324324
}, {
325325
name: 'birthday', title: '出生日期', format: 'date'
326326
}, {
327-
name: 'addTime', title: '添加时间', format: 'datetime'
327+
name: 'addTime', title: '添加时间', format: 'datetime-YY(_)MM(_)DD()HH'
328328
}, {
329329
name: 'count', title: '数量', format: 'number'
330330
}, {

doc/table-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const columns = [{
4747
}, {
4848
name: 'birthday', title: '出生日期', format: 'date'
4949
}, {
50-
name: 'addTime', title: '添加时间', format: 'datetime'
50+
name: 'addTime', title: '添加时间', format: 'datetime-YY(_)MM(_)DD()HH'
5151
}, {
5252
name: 'count', title: '数量', format: 'number'
5353
}, {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kne/info-page",
3-
"version": "0.1.12",
3+
"version": "0.1.13",
44
"description": "一般用在复杂的详情展示页面,InfoPage提供了一个标准的展示信息的格式",
55
"syntax": {
66
"esmodules": true

src/formatView.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,14 @@ const formatView = (value, format, context) => {
144144
return formatList.reduce((value, format) => {
145145
const [name, ...args] = format.split('-');
146146
if (typeof defaultFormat[name] === 'function') {
147-
return defaultFormat[name](value, Object.assign({}, context, { args }));
147+
return defaultFormat[name](
148+
value,
149+
Object.assign({}, context, {
150+
args: args.map(item => {
151+
return item && item.replace(/\(\)/g, ' ').replace(/\(_\)/g, '-');
152+
})
153+
})
154+
);
148155
}
149156
return value;
150157
}, value);

0 commit comments

Comments
 (0)