sv 查看
查看栅格系统是在原 Grid 栅格 基础上构建更高阶的组件,用于简化查看页布局。
import { SVModule } from '@delon/abc/sv';
代码演示
基本
基本查看页。
import { Component } from '@angular/core';
@Component({
selector: 'components-sv-basic',
template: `
<sv-container>
<sv-title>title</sv-title>
<sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
<sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
<sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
<sv label="Default"></sv>
<sv label="Unit" unit="个">10</sv>
<sv label="Unit" unit="个"></sv>
</sv-container>
`,
})
export class ComponentsSvBasicComponent {
}
固定标签宽度
固定标签宽度让布局看起来更加整洁。
import { Component } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'components-sv-fixed',
template: `
<sv-container labelWidth="150">
<sv label="ID">1</sv>
<sv label="Name">asdf</sv>
<sv label="Age">25</sv>
<sv label="Reject" type="danger" col="1"> OMG <a class="ml-sm" (click)="msg.success('to')">Fixed</a> </sv>
<sv label="Long Optional Long Optional" optional="(RMB)">Optional</sv>
<sv label="Optional" optionalHelp="Tips">Optional Help</sv>
<sv label="Default"></sv>
<sv [label]="label">
<ng-template #label>
<a nz-tooltip="test">long</a>
</ng-template>
Custom label
</sv>
</sv-container>
`,
})
export class ComponentsSvFixedComponent {
constructor(public msg: NzMessageService) {}
}
内容类型
通常用于展示页,成功、异常、警告等字段展示。
import { Component } from '@angular/core';
@Component({
selector: 'components-sv-type',
template: `
<sv-container col="4">
<sv label="primary" type="primary">hhhh</sv>
<sv label="success" type="success">hhhh</sv>
<sv label="warning" type="warning">hhhh</sv>
<sv label="danger" type="danger">hhhh</sv>
</sv-container>
`,
})
export class ComponentsSvTypeComponent {
}
垂直布局
垂直布局。
import { Component } from '@angular/core';
@Component({
selector: 'components-sv-vertical',
template: `
<sv-container layout="vertical">
<sv-title>title</sv-title>
<sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
<sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
<sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
</sv-container>
`,
})
export class ComponentsSvVerticalComponent {
}
API
sv-container
参数 | 说明 | 类型 | 默认值 | 全局配置 |
---|---|---|---|---|
[size] | 大小 | ‘small’,’large’ | ‘large’ | ✅ |
[layout] | 布局 | ‘horizontal’,’vertical’ | ‘horizontal’ | ✅ |
[gutter] | 间距 | number | 32 | ✅ |
[col] | 指定信息最多分几列展示,最终一行几列由 col 配置结合响应式规则决定 | ‘1’,’2’,’3’,’4’,’5’,’6’ | 3 | ✅ |
[labelWidth] | 默认标签文本宽度 | number | - | ✅ |
[default] | 默认是否显示默认文本 | boolean | true | ✅ |
[title] | 标题 | string,TemplateRef<void> | - |
sv
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
[col] | 指定信息最多分几列展示,最终一行几列由 col 配置结合响应式规则决定,继承 sv-container | ‘1’,’2’,’3’,’4’,’5’,’6’ | - |
[label] | 标签 | string,TemplateRef<void> | - |
[unit] | 单位 | string,TemplateRef<void> | - |
[default] | 是否显示默认文本,继承 sv-container | boolean | - |
[type] | 类型 | ‘primary’,’success’,’danger’,’warning’ | - |
[optional] | 标签可选信息 | string, TemplateRef<void> | - |
[optionalHelp] | 标签可选帮助 | string, TemplateRef<void> | - |
sv-title
用于展示标题,单独一行。