【问题标题】:Basic math operations in jsrender templatejsrender 模板中的基本数学运算
【发布时间】:2019-04-10 21:06:18
【问题描述】:

我想在jsrender模板中实现数据的加、乘、除。例如,

{{:num1 * (-1.0)}} - {{:num2}} + {{:num3}}

以上在我的以下情况下不起作用:

<circle r="25%" cx="50%" cy="50%" style="stroke-dasharray: {{:num3}} 100; stroke: orange; stroke-dashoffset: {{:num1 * (-1.0)}} - {{:num2}}- {{:num3}}">
    </circle>

【问题讨论】:

    标签: jsrender


    【解决方案1】:

    在此处查看表达式示例https://www.jsviews.com/#paths

    你可以写,例如:

    ...stroke-dashoffset: {{:num1 * (-1.0) - num2 - num3}}...
    

    ...stroke-dashoffset: {{:num1*(-1.0)-num2-num3}}...
    

    如果您希望它呈现表达式的结果,而不是单独的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-25
      • 1970-01-01
      • 2020-10-28
      相关资源
      最近更新 更多