From af52e8e6ec9b93ab3717fe3a09cd03b14bd1d5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Fri, 28 Jul 2023 21:36:43 +0800 Subject: [PATCH] chore: update demo (#1631) --- packages/abc/st/demo/basic.md | 32 +++++++++++++++++++++++++++----- packages/abc/st/st.interfaces.ts | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/packages/abc/st/demo/basic.md b/packages/abc/st/demo/basic.md index c17fda2fa..acbf266ad 100644 --- a/packages/abc/st/demo/basic.md +++ b/packages/abc/st/demo/basic.md @@ -15,26 +15,48 @@ Quickly generate tables; use `res` to adapted backend data format. ```ts import { Component, ViewChild } from '@angular/core'; + import { STColumn, STComponent } from '@delon/abc/st'; +interface User { + id: number; + picture: { + thumbnail: string; + }; + name: { + last: string; + first: string; + }; + nat: string; + gender: string; + email: string; + phone: string; + price: number; + registered: Date; +} + @Component({ selector: 'app-demo', template: ` - `, + ` }) export class DemoComponent { url = `/users?total=2&field=list`; params = { a: 1, b: 2 }; @ViewChild('st', { static: false }) private st!: STComponent; - columns: STColumn[] = [ + columns: Array> = [ { title: '编号', index: 'id', width: 80 }, - { title: '头像', type: 'img', width: 60, index: 'picture.thumbnail' }, + { title: '头像', index: 'picture.thumbnail', type: 'img', width: 60 }, { title: '邮箱', index: 'email', width: 80 }, { title: '电话', index: 'phone' }, - { title: { text: '佣金', optional: '(单位:元)', optionalHelp: '计算公式=订单金额 * 0.6%' }, index: 'price', type: 'currency' }, - { title: '注册时间', type: 'date', index: 'registered' }, + { + title: { text: '佣金', optional: '(单位:元)', optionalHelp: '计算公式=订单金额 * 0.6%' }, + index: 'price', + type: 'currency' + }, + { title: '注册时间', type: 'date', index: 'registered' } ]; setRow(): void { diff --git a/packages/abc/st/st.interfaces.ts b/packages/abc/st/st.interfaces.ts index 7b31b8641..372044c23 100644 --- a/packages/abc/st/st.interfaces.ts +++ b/packages/abc/st/st.interfaces.ts @@ -248,7 +248,7 @@ export interface STColumn { title?: string | STColumnTitle; /** * 列数据在数据项中对应的 key,支持 `a.b.c` 的嵌套写法,例如: - * - `id` + * - `id` (需要指定类型才能智能提示) * - `price.market` * - `[ 'price', 'market' ]` */