简体   繁体   中英

Using ES6 Template Literals in a Javascript script on a STRUCTR page

I am trying to serve a collapsible tree diagram from my STRUCTR 2.01 app to describe a hierarchical section of my graph. I based the page on this example

The page correctly serves the nodes but cannot parse the paths. These are defined in the javascript using ES6 template literals.

When I serve the same page directly (ie not from STRUCTR) and view in the same browser etc. it works fine.

Is STRUCTR blocking or incorrectly interpreting the javascript template literals ?

In any content served by Structr, any text enclosed in ${...} is treated as an expression to be interpreted by Structr (we call it StructrScript) serverside.

Seems to be a conflict with ES6 Template Expressions.

As a workaround, you can put the JavaScript code in a file where it's not interpreted by Structr.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM