UNPKG

@lcap/nasl

Version:

NetEase Application Specific Language

70 lines (67 loc) 2.11 kB
/* UI组件基础库 */ declare namespace nasl.ui { /* 表单检验类型,用于表单校验函数 * @example let formValidate: ValidateResult = $refs.form2.validate(); */ export interface ValidateResult { valid: Boolean; } /* current: 推导类型 */ export class Current<T> { item: T; constructor(obj: Partial<Current<T>>); } export class ViewComponentOptions { /** * 显示条件 * 是否展示组件 */ _if: Boolean; /** * 工具提示 * 在鼠标悬停时显示的文字 */ _tooltip: String; /** * 样式 * 任意组件的样式,使用 inline CSS */ _staticStyle: String; /** * 动态文本颜色 * 动态调整文本颜色,CSS 的 color 值 */ _color: String; /** * 动态背景颜色 * 动态调整背景颜色,CSS 的 background-color 值 */ _backgroundColor: String; /** * 动态背景图片 * 动态调整背景图片,CSS 的 background-image 值 */ _backgroundImage: String; } type ViewComponentOptionSetKeys = "_if"; type ViewComponentOptionGetKeys = "_if"; export class ViewComponentMethods { /** * 设置组件属性值,在逻辑中可直接调用此方法 * 仅支持设置 ViewComponentOptionSetKeys 中的属性 * example: $refs.uploader_1.setPropValue('_if', false); */ setPropValue<K extends ViewComponentOptionSetKeys>(key: K, value: ViewComponentOptions[K]): void; /** * 获取组件属性值,在逻辑中可直接调用此方法 * 仅支持获取 ViewComponentOptionGetKeys 中的属性 * example: $refs.uploader_1.getPropValue('_if'); */ getPropValue<K extends ViewComponentOptionGetKeys>(key: K): ViewComponentOptions[K]; } /* 在页面上弹出消息 */ export function showMessage(text: Any): void; /** 跳转到指定页面 * @example nasl.ui.destination('pageType.some_view.sub1_view', { param1, param2, ... }); * pageType 为 namespace,如 pc 或者 m,必填 */ export function destination(path: String, args: object): void; }