Options
All
  • Public
  • Public/Protected
  • All
Menu

模板渲染处理类

Hierarchy

  • Templete

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Templete(tpl: string, config?: ITempleteConfig): Templete
  • Parameters

    • tpl: string
    • config: ITempleteConfig = ...

    Returns Templete

Properties

close

close: string

open

open: string

tpl

tpl: string

模板字符串

Static cache

cache: object = ...

缓存

Methods

Private error

  • error(e: any, tplog?: string): string
  • Parameters

    • e: any
    • tplog: string = ''

    Returns string

Private exp

  • exp(str: any): RegExp
  • Parameters

    • str: any

    Returns RegExp

parse

  • parse(data: any): any
  • 解析编译模板字符串并返回渲染完成的字符和记录缓存

    Parameters

    • data: any

    Returns any

Private query

  • query(type?: any, a?: any, b?: any): RegExp
  • 匹配满足规则内容

    Parameters

    • Optional type: any
    • Optional a: any
    • Optional b: any

    Returns RegExp

render

  • render(model: object, callback?: (tpl: string) => string): any
  • 模板渲染数据

    Parameters

    • model: object

      数据

    • Optional callback: (tpl: string) => string

      渲染完成的回调, 可以在内休其值

        • (tpl: string): string
        • Parameters

          • tpl: string

          Returns string

    Returns any

    返回模板渲染完的字符串

Static create

  • create(str: string, config?: ITempleteConfig): Templete
  • 创建模板对象

    Parameters

    • str: string
    • Optional config: ITempleteConfig

    Returns Templete

    返回模板对象实例

Private Static escape

  • escape(html: any): string
  • Parameters

    • html: any

    Returns string

Generated using TypeDoc