Template

Template

new Template(raw, nameListopt, onChangeopt, bindDataopt)

Source:

字符串模板

Example
// 局部变量成员名

    $.Template('[ ${new Date()} ]  Hello, ${this.name} !')[0]    // 'name'
Parameters:
Name Type Attributes Description
raw string
nameList Array <optional>

Name list of the Local variable

onChange function <optional>

Call with New & Old value

bindData Array <optional>

The parameter bound to onChange

Methods

evaluate(contextnullable, parameteropt) → {string}

Source:

表达式求值

Example
// 模板求值

    $.Template(
        "[ ${this.time} ]  Hello, ${scope.creator}'s ${view.name} !",
        ['view', 'scope']
    ).evaluate(
        {time: '2015-04-30'},
        {name: 'iQuery.js'},
        {creator: 'TechQuery'}
    )

    // "[ 2015-04-30 ]  Hello, TechQuery's iQuery.js !"
Parameters:
Name Type Attributes Description
context object <nullable>

Value of this in the expression

parameter * <optional>

One or more value of the Local variable

Returns:
Type
string