Options
All
  • Public
  • Public/Protected
  • All
Menu

前端页面元素

example

<u-input size="small" v-model="value" @change="onChange">

Hierarchy

Index

Constructors

constructor

  • Parameters

    • Optional source: Partial<Element>

      需要合并的部分参数

    Returns Element

Properties

Protected Readonly JSON_EXCLUDED_KEYS

JSON_EXCLUDED_KEYS: Set<string>

toJSON 时需要去除的键,为了避免出现 CircularJSON

Readonly _cacheTimestamp

_cacheTimestamp: string = ...

前端记录缓存的时间戳

Protected _mutable

_mutable: boolean = true

可修改标志,内部属性 标记在构造函数结束后是否可修改

Readonly _uuid

_uuid: string = ...

唯一 uuid 目前主要用于前端 Debug 区分两个实例

Optional Readonly attrList

attrList: Attr[] = ...

属性列表 和原来的 attrsList 不同,注意区分

Optional Readonly children

children: Element[] = ...

子元素

Readonly createdBy

createdBy: string = ...

创建人

Readonly createdTime

createdTime: string = ...

创建时间

Optional Readonly directiveList

directiveList: Directive[] = ...

指令列表

editable

editable: boolean = true

是否可编辑

editing

editing: boolean = false

是否正在编辑 前端 UI 状态

Optional Readonly eventList

eventList: Event[] = ...

事件列表

expanded

expanded: boolean = false

节点是否为展开状态 前端 UI 状态

Readonly id

id: string = ...

元素 Id

Readonly ideVersion

ideVersion: string = ...

IDE 版本

isLeaf

isLeaf: boolean = false

是否为叶子节点 前端 UI 状态

Readonly level

level: LEVEL_ENUM = ...

概念类型

loading

loading: boolean = false

是否正在请求 前端 UI 状态

Readonly name

name: string = ...

元素名称 用户可以自定义 Vue 中的 ref

nodePath

nodePath: string = ...

当前节点路径,只在前端动态计算后使用

Optional Readonly parent

parent: Element = ...

所在父元素

Readonly parentId

parentId: string = ...

所在父元素 Id

Optional Readonly slotScope

slotScope: string = ...

插槽 scope 表达式

example

'scope'

Optional Readonly slotTarget

slotTarget: string = ...

插槽目标

example

'"cell"'

Optional Readonly staticClass

staticClass: string = ...

静态 class 名 不计划支持动态 class

Optional Readonly staticStyle

staticStyle: string = ...

静态 style 不计划支持动态样式

Readonly tag

tag: string = ...

元素标签

Readonly type

type: number = 0

元素类型 去除了 expression 和 text,目前只有一种节点类型

Readonly updatedBy

updatedBy: string = ...

修改人

Readonly updatedTime

updatedTime: string = ...

修改时间

Optional Readonly view

view: View = ...

所在子页面

Readonly viewId

viewId: string = ...

所在父元素 Id

Methods

addAttr

  • addAttr(data: Attr): Promise<void>
  • 添加组件属性

    Parameters

    Returns Promise<void>

addDirective

  • addDirective(data: Directive): Promise<void>
  • 添加组件指令

    Parameters

    Returns Promise<void>

addEvent

  • 添加组件事件

    Parameters

    Returns Promise<Event>

assign

  • assign(source: any): void
  • Parameters

    • source: any

    Returns void

create

  • 添加元素

    Returns Promise<Element>

deepPick

  • deepPick(source: any, keys?: string[]): void
  • 从对象中深度获取

    example

    比如一般后端返回只是添加了个 id

    this.deepPick(result, ['id'])
    

    Parameters

    • source: any
    • keys: string[] = ...

    Returns void

delete

  • delete(): Promise<void>
  • 删除元素

    Returns Promise<void>

deleteAttr

  • deleteAttr(attr: Attr): Promise<void>
  • 删除组件属性

    Parameters

    Returns Promise<void>

deleteDirective

  • deleteDirective(directive: Directive): Promise<void>
  • 删除组件属性

    Parameters

    Returns Promise<void>

deleteEvent

  • deleteEvent(event: Event): Promise<void>
  • 删除组件属性

    Parameters

    Returns Promise<void>

duplicate

  • duplicate(): Promise<void>
  • 添加元素副本 在所在父节点的后面添加一个相同的元素

    Returns Promise<void>

emit

  • emit(eventName: string, ...args: any[]): void
  • 触发事件

    Parameters

    • eventName: string

      事件名

    • Rest ...args: any[]

      事件参数

    Returns void

emitVertexIdToNameChange

  • emitVertexIdToNameChange(): void

findElementByAttr

  • findElementByAttr(name: string, value: string): Element
  • 根据属性查找元素

    Parameters

    • name: string
    • value: string

    Returns Element

findElementByTag

  • findElementByTag(tag: string): Element
  • 根据标签查找元素

    Parameters

    • tag: string

    Returns Element

findUsage

  • findUsage(): Promise<any>
  • 查找引用

    Returns Promise<any>

getAttr

  • getAttr(name: string): Attr
  • 获取组件属性

    Parameters

    • name: string

    Returns Attr

off

  • 取消监听事件

    Parameters

    Returns void

on

  • 监听事件

    Parameters

    Returns void

once

  • 只监听一次事件

    Parameters

    Returns void

pick

  • pick(source: any, keys?: string[]): void
  • Parameters

    • source: any
    • keys: string[] = ...

    Returns void

plainAssign

  • plainAssign(source: any): void
  • Parameters

    • source: any

    Returns void

setAttr

  • setAttr(name: string, type: "string" | "static" | "dynamic", value?: any): Promise<void>
  • 设置组件属性

    Parameters

    • name: string
    • type: "string" | "static" | "dynamic"
    • Optional value: any

    Returns Promise<void>

setName

  • setName(name: string): Promise<void>
  • 设置组件名称

    Parameters

    • name: string

    Returns Promise<void>

toDesignerVue

  • 转换成设计器中使用的 Vue 文件

    Parameters

    Returns string

toHTML

  • 同 toVue 方法

    Parameters

    Returns string

toJSON

  • toJSON(parentKey?: string, excludedKeys?: string[]): any
  • 去除循环依赖,转为纯 JSON

    Parameters

    • Optional parentKey: string

      外面的 key

    • excludedKeys: string[] = ...

      需要额外排除的 keys

    Returns any

toPlainJSON

  • toPlainJSON(parentKey?: string, excludedKeys?: string[]): any
  • 转为单层的 JSON

    Parameters

    • Optional parentKey: string

      外面的 key

    • excludedKeys: string[] = ...

      需要额外排除的 keys

    Returns any

toVue

  • 转换成 Vue 的模板格式

    Parameters

    Returns string

update

  • 修改元素

    Parameters

    Returns Promise<Element>

Private Static _fromASTNode

  • _fromASTNode(astNode: ASTElement, $def: any, dataSchema?: string): Element
  • 从 Vue 的 ASTNode 转换成 ASL 元素

    Parameters

    • astNode: ASTElement

      Vue 的 ASTNode

    • $def: any
    • Optional dataSchema: string

    Returns Element

Private Static _parseExpression

  • _parseExpression(value: string, $def?: any, dataSchema?: string): LogicItem
  • Parameters

    • value: string
    • Optional $def: any
    • Optional dataSchema: string

    Returns LogicItem

Static from

  • 从后端 JSON 生成规范的 Element 对象

    Parameters

    Returns Element

Static fromHTML

  • 从模板生成规范的 Element 对象

    Parameters

    Returns Element

Static getVertexByRef

  • getVertexByRef(ref: string): Vertex
  • 通过 Ref 去查找点

    Parameters

    • ref: string

    Returns Vertex

Static parse

  • parse(html: string, $def?: any): Element
  • 解析 Vue 模板 该方法不会绑定 view 和 parent,如果是添加元素优先使用 fromHTML

    todo

    处理多个元素的问题

    Parameters

    • html: string

      Vue 的模板

    • Optional $def: any

    Returns Element

Generated using TypeDoc