bixi
Version:
企业级中后台前端解决方案
62 lines (53 loc) • 976 B
Markdown
title:
zh-CN: 新增支持默认值
order: 5
## zh-CN
有时动态的去新增内容,`editable-table` 提供了 `(addRow)` 方法。
## en-US
```ts
import { Component } from '@angular/core';
import { FormGroup } from '@angular/forms';
@Component({
selector: 'bixi-editable-demo-function',
template: `
<bixi-editable-table [(ngModel)]="rows" [cols]="cols" (addRow)="addRow($event)"></bixi-editable-table>
`
})
export class TestComponent {
cols = [
{
key: 'name',
name: '审核点'
},
{
key: 'relation',
name: '关系'
},
{
key: 'content',
name: '风险内容'
},
{
key: 'desc',
name: '问题描述'
}
];
rows = [
{
name: '组合1',
relation: '等于',
content: '字段1',
desc: 'A类型'
}
]
addRow(form: FormGroup) {
form.patchValue({
name: 'hello',
relation: `大于`,
content: '123'
})
}
}
```