当前位置: 首页 > 知识库问答 >
问题:

模板文字JavaScript问题

相高谊
2023-03-14

我试图使一个JSON对象与一些嵌套模板文字。无法理解,为什么这不起作用。它在Test键上抛出了一个错误,我试图使其值与buildParams相同

var buildActionRequest = {
buildArguments: { //Inside Entity defineing the request to build. 
    entityObjectModel: 'document',
    request: {
        method: 'get',
        entity: 'Element',
        entityIdentifier: 'ById',
        entityId: "(" + '"' + reqEntity.entityId + '"' + ")",
    },
  //  and: 'innerHTML',
},
'buildParams': { // defining the parameters of recusiosn and output
    recurse: null,// this is to check if arguments have to be recursed or not.
    outPutCondition: null,//an operator can be added,if True, if False
    output: {
        outputType: 'callback',// [isOneof ( response, callback//operator) ]
        callBackReq : {
            callbackClass: 'actionEngineV5Instance',
            callback: 'processStringRequest',
            args: "cleanReq",
            andThen: 'innerHTML',
            test:`${buildActionRequest.buildParams}`
        }
    }


}

}console.log(“test”,BuildActionRequest.BuildParams.Output.CallbackReq.Test)

我确实读了不少帖子,但[这]和{这}对我来说有点无法理解。

共有1个答案

宗翔宇
2023-03-14

怎么样

callBackReq : {
            callbackClass: 'actionEngineV5Instance',
            callback: 'processStringRequest',
            args: "cleanReq",
            andThen: 'innerHTML',
            test: JSON.parse(buildActionRequest.buildParams)
        }
 类似资料:
  • 我有一个非常特殊的例子,我需要在一个模板文本中使用一个模板文本,但是我做不到。 代码如下所示: 然而,我必须将其包装在函数中,同时保持变量的值,这会导致错误发生。无论我是否逃脱了滴答声。 使用转义滴答,我收到以下错误消息: 错误:预期的某个链接但未提供 没有,我得到: 意外标记,预期“”,” 我该怎么处理这件事? 编辑:可能应该注意的是,中传递的代码将被渲染并且需要使用它。它最终将通过传递给另一个

  • 主要内容:1.多行字符串,2.字符串插值,3.标记模板,4.原始字符串,5.String.fromCodePoint()模板文字是ECMAScript 2015/ES6中引入的新功能。它提供了创建多行字符串和执行字符串插值的简便方法。模板文字是字符串文字,并允许嵌入表达式。 在ES6之前,模板文字被称为模板字符串。 与字符串中的引号不同,模板文字用反引号()字符(QWERTY键盘中ESC键下方的键)括起来。 模板文字可以包含占位符,由美元符号和大括号表示。在反引号内,如果要使用表达式,则可以将该

  • 假设我需要创建一个javascript库,这样: 如果doSome方法工作u对象的值,那么doSome2和doSome3也工作。 但是像这样链接方法呢: 注意:方法可以随机链接,如: 实例:https://jsbin.com/vijehotora/edit?js安慰

  • 当我的模板包含一些JavaScript时,我遇到了一个问题。例如: 果然,模板解释器希望将双卷曲大括号{{}}中的所有内容解释为变量。现在我想知道是否有办法关闭类似于的此类行为。

  • 根据不同的值,判断应该用什么元素,大佬们有什么方法优化一下呀

  • 目的: 包含处理文本的常量和类 The string module dates from the earliest versions of Python. Many of the functions previously implemented in this module have been moved to methods of str objects. The string module r