Skip to content

@vtj


@vtj / core / ProjectModel

Class: ProjectModel

Constructors

new ProjectModel()

new ProjectModel(schema): ProjectModel

Parameters

schema

ProjectSchema

Returns

ProjectModel

Defined in

packages/core/src/models/project.ts:94

Properties

__BASE_PATH__

__BASE_PATH__: string = '/'

Defined in

packages/core/src/models/project.ts:81


apis

apis: ApiSchema[] = []

Defined in

packages/core/src/models/project.ts:77


blocks

blocks: BlockFile[] = []

Defined in

packages/core/src/models/project.ts:76


config

config: ProjectConfig = {}

Defined in

packages/core/src/models/project.ts:80


currentFile

currentFile: null | BlockFile | PageFile = null

Defined in

packages/core/src/models/project.ts:79


dependencies

dependencies: Dependencie[] = []

Defined in

packages/core/src/models/project.ts:74


description

description: string = ''

Defined in

packages/core/src/models/project.ts:72


homepage

homepage: string = ''

Defined in

packages/core/src/models/project.ts:73


id

id: string = ''

Defined in

packages/core/src/models/project.ts:70


meta

meta: MetaSchema[] = []

Defined in

packages/core/src/models/project.ts:78


name

name: string = ''

Defined in

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


pages

pages: PageFile[] = []

Defined in

packages/core/src/models/project.ts:75


attrs

static attrs: string[]

Defined in

packages/core/src/models/project.ts:82

Methods

active()

active(file, silent): void

打开文件

Parameters

file

BlockFile | PageFile

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:166


cleanPagesDsl()

cleanPagesDsl(files): void

Parameters

files

PageFile[]

Returns

void

Defined in

packages/core/src/models/project.ts:119


cloneBlock()

cloneBlock(block, silent): void

Parameters

block

BlockFile

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:536


clonePage()

clonePage(page, parentId?, silent?): void

复制页面

Parameters

page

PageFile

parentId?

string

silent?

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:372


createBlock()

createBlock(block, silent): Promise<void>

创建区块

Parameters

block

BlockFile

silent

boolean = false

Returns

Promise<void>

Defined in

packages/core/src/models/project.ts:485


createPage()

createPage(page, parentId?, silent?): Promise<void>

新建页面

Parameters

page

PageFile

parentId?

string

silent?

boolean = false

Returns

Promise<void>

Defined in

packages/core/src/models/project.ts:296


deactivate()

deactivate(silent): void

关闭文件

Parameters

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:180


existApiName()

existApiName(name, excludes): boolean

Parameters

name

string

excludes

string[] = []

Returns

boolean

Defined in

packages/core/src/models/project.ts:665


existBlockName()

existBlockName(name, excludes): boolean

检查是否存在名称的区块

Parameters

name

string

excludes

string[] = []

Returns

boolean

Defined in

packages/core/src/models/project.ts:596


existMetaCode()

existMetaCode(code, excludes): boolean

Parameters

code

string

excludes

string[] = []

Returns

boolean

Defined in

packages/core/src/models/project.ts:712


existPageName()

existPageName(name, excludes): boolean

检测是否存在名称的页面

Parameters

name

string

excludes

string[] = []

Returns

boolean

Defined in

packages/core/src/models/project.ts:608


genSource()

genSource(): void

Returns

void

Defined in

packages/core/src/models/project.ts:753


getBlock()

getBlock(id): undefined | BlockFile

获取区块文件

Parameters

id

string

Returns

undefined | BlockFile

Defined in

packages/core/src/models/project.ts:476


getPage()

getPage(id): undefined | PageFile

根据页面id查找页面或目录

Parameters

id

string

Returns

undefined | PageFile

Defined in

packages/core/src/models/project.ts:248


getPages()

getPages(): PageFile[]

查找全部页面,不含目录

Returns

PageFile[]

Defined in

packages/core/src/models/project.ts:273


isPageFile()

isPageFile(file): file is PageFile

Parameters

file

BlockFile | PageFile

Returns

file is PageFile

Defined in

packages/core/src/models/project.ts:115


publish()

publish(file?): void

Parameters

file?

BlockFile | PageFile

Returns

void

Defined in

packages/core/src/models/project.ts:740


removeApi()

removeApi(name, silent): void

删除api

Parameters

name

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:647


removeBlock()

removeBlock(id, silent): void

删除区块

Parameters

id

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:567


removeDeps()

removeDeps(item, silent): void

删除依赖

Parameters

item

Dependencie

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:226


removeMeta()

removeMeta(code, silent): void

Parameters

code

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:694


removePage()

removePage(id, silent): void

删除页面或目录

Parameters

id

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:439


saveToBlock()

saveToBlock(page, silent): Promise<void>

Parameters

page

PageFile

silent

boolean = false

Returns

Promise<void>

Defined in

packages/core/src/models/project.ts:402


setApi()

setApi(item, silent): void

新增或更新api

Parameters

item

ApiSchema

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:618


setConfig()

setConfig(config, silent): void

Parameters

config

ProjectConfig

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:728


setDeps()

setDeps(item, silent): void

新增或更新依赖

Parameters

item

Dependencie

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:196


setHomepage()

setHomepage(id, silent): void

Parameters

id

string

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:716


setMeta()

setMeta(item, silent): void

Parameters

item

MetaSchema

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:669


toDsl()

toDsl(_version?): ProjectSchema

Parameters

_version?

string

Returns

ProjectSchema

Defined in

packages/core/src/models/project.ts:128


update()

update(schema, silent): void

Parameters

schema

Partial<ProjectSchema>

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:100


updateBlock()

updateBlock(block, silent): void

Parameters

block

BlockFile

更新区块

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:515


updatePage()

updatePage(page, silent): void

更新页面

Parameters

page

PageFile

silent

boolean = false

Returns

void

Defined in

packages/core/src/models/project.ts:348

Released under the MIT License.