Skip to content

@vtj


@vtj / core / BlockModel

Class: BlockModel

Constructors

new BlockModel()

new BlockModel(schema): BlockModel

Parameters

schema

BlockSchema

Returns

BlockModel

Defined in

packages/core/src/models/block.ts:65

Properties

__VTJ_BLOCK__

readonly __VTJ_BLOCK__: boolean = true

Defined in

packages/core/src/models/block.ts:30


computed

computed: Record<string, JSFunction> = {}

Defined in

packages/core/src/models/block.ts:37


css

css: string = ''

Defined in

packages/core/src/models/block.ts:39


dataSources

dataSources: Record<string, DataSourceSchema> = {}

Defined in

packages/core/src/models/block.ts:43


disposed

disposed: boolean = false

Defined in

packages/core/src/models/block.ts:46


emits

emits: (string | BlockEmit)[] = []

Defined in

packages/core/src/models/block.ts:41


id

readonly id: string

Defined in

packages/core/src/models/block.ts:31


inject

inject: BlockInject[] = []

Defined in

packages/core/src/models/block.ts:33


lifeCycles

lifeCycles: Record<string, JSFunction> = {}

Defined in

packages/core/src/models/block.ts:35


locked

locked: boolean = false

Defined in

packages/core/src/models/block.ts:45


methods

methods: Record<string, JSFunction> = {}

Defined in

packages/core/src/models/block.ts:36


name

name: string = ''

Defined in

packages/core/src/models/block.ts:32


nodes

nodes: NodeModel[] = []

Defined in

packages/core/src/models/block.ts:44


props

props: (string | BlockProp)[] = []

Defined in

packages/core/src/models/block.ts:40


slots

slots: (string | BlockSlot)[] = []

Defined in

packages/core/src/models/block.ts:42


state

state: BlockState = {}

Defined in

packages/core/src/models/block.ts:34


watch

watch: BlockWatch[] = []

Defined in

packages/core/src/models/block.ts:38


normalAttrs

static normalAttrs: string[]

Defined in

packages/core/src/models/block.ts:48

Methods

addNode()

addNode(node, target?, position?, silent?): void

添加节点

Parameters

node

NodeModel

target?

NodeModel

position?

DropPosition = 'inner'

silent?

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:430


cloneNode()

cloneNode(target, silent): NodeModel

克隆节点

Parameters

target

NodeModel

silent

boolean = false

Returns

NodeModel

Defined in

packages/core/src/models/block.ts:546


dispose()

dispose(): void

销毁

Returns

void

Defined in

packages/core/src/models/block.ts:113


isChild()

isChild(node): boolean

Parameters

node

NodeModel

Returns

boolean

Defined in

packages/core/src/models/block.ts:573


lock()

lock(silent): void

Parameters

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:553


move()

move(node, target?, position?, silent?): void

移动节点

Parameters

node

NodeModel

target?

NodeModel

position?

DropPosition = 'inner'

silent?

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:484


moveNext()

moveNext(node, silent): void

向后交换节点

Parameters

node

NodeModel

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:525


movePrev()

movePrev(node, silent): void

向前交换节点

Parameters

node

NodeModel

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:505


removeDataSource()

removeDataSource(name, silent): void

删除数据源

Parameters

name

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:382


removeEmit()

removeEmit(emit, silent): void

删除事件

Parameters

emit

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:287


removeFunction()

removeFunction(type, name, silent): void

删除通用函数属性

Parameters

type

"computed" | "lifeCycles" | "methods"

name

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:143


removeInject()

removeInject(inject, silent): void

删除注入

Parameters

inject

BlockInject

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:355


removeNode()

removeNode(node, silent): void

删除节点

Parameters

node

NodeModel

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:468


removeProp()

removeProp(prop, silent): void

删除属性

Parameters

prop

BlockProp

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:253


removeSlot()

removeSlot(slot, silent): void

删除插槽

Parameters

slot

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:322


removeState()

removeState(name, silent): void

删除状态

Parameters

name

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:175


removeWatch()

removeWatch(watch, silent): void

删除 watch

Parameters

watch

BlockWatch

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:217


setCss()

setCss(content, silent): void

更新CSS

Parameters

content

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:186


setDataSource()

setDataSource(source, silent): void

设置数据源

Parameters

source

DataSourceSchema

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:370


setEmit()

setEmit(emit, silent): void

设置事件

Parameters

emit

string | BlockEmit

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:269


setFunction()

setFunction(type, name, value, silent): void

设置通用函数属性

Parameters

type

"computed" | "lifeCycles" | "methods"

name

string

value

JSFunction

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:126


setInject()

setInject(inject, silent): void

设置注入

Parameters

inject

BlockInject

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:339


setProp()

setProp(prop, silent): void

定义属性参数

Parameters

prop

BlockProp

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:234


setSlot()

setSlot(slot, silent): void

设置插槽

Parameters

slot

string | BlockSlot

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:304


setState()

setState(name, value, silent): void

设置状态

Parameters

name

string

value

JSONValue | JSExpression | JSFunction

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:160


setWatch()

setWatch(watch, silent): void

新增或更新 watch

Parameters

watch

BlockWatch

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:197


toDsl()

toDsl(version?): BlockSchema

获取DSL

Parameters

version?

string

Returns

BlockSchema

Defined in

packages/core/src/models/block.ts:91


unlock()

unlock(silent): void

Parameters

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:563


update()

update(schema, silent): void

Parameters

schema

BlockSchema

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/block.ts:71

Released under the MIT License.