bixi
Version:
企业级中后台前端解决方案
43 lines (35 loc) • 1.14 kB
text/typescript
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { get } from '@bixi/core/utils';
import { ILinkCol } from '../table.type';
import { hasKey, propGetter } from '../utils';
import { ColBase } from './col.base';
export class BixiTableColLinkComponent extends ColBase {
constructor(
private sanitizer: DomSanitizer
) {
super();
}
col: ILinkCol;
get target() {
return get(this.col, 'target', '_self');
}
get href() {
let href;
if (!hasKey(this.col, 'href')) {
href = this.value;
} else {
href = propGetter(this.row, this.col, this.index, get(this.col, 'href'));
}
return this.sanitizer.bypassSecurityTrustUrl(href || 'javascript: void 0');
}
}