-1

所以我正在寻找修改这个javascript。

剧本上写着:存货有限!7 人正在查看此内容。

“7”是代码中的视图数。但是,我希望在该数字上加上 +8,这样看起来我有更多的浏览量。我不知道如何将 +8 添加到视图数量。

这是代码:

<span class="banana-statement">
  <span class="banana-qty-sentence">
    {% if options.show_only_x_left and counts.stock < options.only_left_threshold %}
      <span class="banana-only-x-left">Only <span class="banana-stock-qty">{{ counts.stock }}</span> left!</span>
    {% else %}
      <span class="banana-default-stock-msg">{{ options.default_stock_message }}</span>
    {% endif %}
  </span>
  {% if counts.views >= options.min_view_count_to_show %}
    <span class="banana-views-sentence banana-sentence {% if counts.views > 1 %}multiple-bananas{% endif %}">
      <span class="banana-count">{{ counts.views + 5}}</span>
      {% if counts.views > 1 %}people are{% else %}person is{% endif %}
      viewing this{% if counts.orders >= options.min_order_count_to_show and counts.carts >= options.min_cart_count_to_show %},{% elsif counts.orders < options.min_order_count_to_show and counts.carts < options.min_cart_count_to_show %}.{% else %} and{% endif %}
    </span>
  {% endif %}
  {% if counts.orders >= options.min_order_count_to_show %}
    <span class="banana-orders-sentence banana-sentence {% if counts.orders > 1 %}multiple-bananas{% endif %}">
      <span class="banana-count">{{ counts.orders }}</span>
      {% if counts.views < options.min_view_count_to_show %}{% if counts.orders > 1 %}people{% else %}person{% endif %}{% endif %} recently purchased {% if counts.views < options.min_view_count_to_show %}this{% else %}it{% endif %}{% if counts.carts < options.min_cart_count_to_show %}.{% else %} and {% endif %}
    </span>
  {% endif %}
  {% if counts.carts >= options.min_cart_count_to_show %}
    <span class="banana-carts-sentence banana-sentence {% if counts.carts > 1 %}multiple-bananas{% endif %}">
      <span class="banana-count">{{ counts.carts }}</span>
      {% if counts.orders < options.min_order_count_to_show %}{% if counts.carts > 1 %}people{% else %}person{% endif %}{% endif %}{% if counts.carts > 1 %} have {% if counts.orders < options.min_order_count_to_show and counts.views < options.min_view_count_to_show %}this{% else %}it{% endif %}{% else %} has this{% endif %} in their cart.
    </span>
  {% endif %}
4

1 回答 1

1

为了在液体中添加,您必须使用加号过滤器

所以基本上,你只需要更改{{ counts.views + 5}}{{ counts.views | plus: 5}}

于 2018-08-15T21:32:58.410 回答