sv 查看

查看栅格系统是在原 Grid 栅格 基础上构建更高阶的组件,用于简化查看页布局。

  1. import { SVModule } from '@delon/abc/sv';

代码演示

Mock模拟数据 - 图1

基本

基本查看页。

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'components-sv-basic',
  4. template: `
  5. <sv-container>
  6. <sv-title>title</sv-title>
  7. <sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
  8. <sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
  9. <sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
  10. <sv label="Default"></sv>
  11. <sv label="Unit" unit="个">10</sv>
  12. <sv label="Unit" unit="个"></sv>
  13. </sv-container>
  14. `,
  15. })
  16. export class ComponentsSvBasicComponent {
  17. }

Mock模拟数据 - 图2

固定标签宽度

固定标签宽度让布局看起来更加整洁。

  1. import { Component } from '@angular/core';
  2. import { NzMessageService } from 'ng-zorro-antd/message';
  3. @Component({
  4. selector: 'components-sv-fixed',
  5. template: `
  6. <sv-container labelWidth="150">
  7. <sv label="ID">1</sv>
  8. <sv label="Name">asdf</sv>
  9. <sv label="Age">25</sv>
  10. <sv label="Reject" type="danger" col="1"> OMG <a class="ml-sm" (click)="msg.success('to')">Fixed</a> </sv>
  11. <sv label="Long Optional Long Optional" optional="(RMB)">Optional</sv>
  12. <sv label="Optional" optionalHelp="Tips">Optional Help</sv>
  13. <sv label="Default"></sv>
  14. <sv [label]="label">
  15. <ng-template #label>
  16. <a nz-tooltip="test">long</a>
  17. </ng-template>
  18. Custom label
  19. </sv>
  20. </sv-container>
  21. `,
  22. })
  23. export class ComponentsSvFixedComponent {
  24. constructor(public msg: NzMessageService) {}
  25. }

Mock模拟数据 - 图3

内容类型

通常用于展示页,成功、异常、警告等字段展示。

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'components-sv-type',
  4. template: `
  5. <sv-container col="4">
  6. <sv label="primary" type="primary">hhhh</sv>
  7. <sv label="success" type="success">hhhh</sv>
  8. <sv label="warning" type="warning">hhhh</sv>
  9. <sv label="danger" type="danger">hhhh</sv>
  10. </sv-container>
  11. `,
  12. })
  13. export class ComponentsSvTypeComponent {
  14. }

Mock模拟数据 - 图4

垂直布局

垂直布局。

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'components-sv-vertical',
  4. template: `
  5. <sv-container layout="vertical">
  6. <sv-title>title</sv-title>
  7. <sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
  8. <sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
  9. <sv label="Firefox">A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</sv>
  10. </sv-container>
  11. `,
  12. })
  13. export class ComponentsSvVerticalComponent {
  14. }

API

sv-container

参数说明类型默认值全局配置
[size]大小‘small’,’large’‘large’
[layout]布局‘horizontal’,’vertical’‘horizontal’
[gutter]间距number32
[col]指定信息最多分几列展示,最终一行几列由 col 配置结合响应式规则决定‘1’,’2’,’3’,’4’,’5’,’6’3
[labelWidth]默认标签文本宽度number-
[default]默认是否显示默认文本booleantrue
[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-containerboolean-
[type]类型‘primary’,’success’,’danger’,’warning’-
[optional]标签可选信息string, TemplateRef<void>-
[optionalHelp]标签可选帮助string, TemplateRef<void>-

sv-title

用于展示标题,单独一行。