所以我想修改此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 %}
答案 0 :(得分:1)
要添加液体,必须使用plus filter。
因此,基本上,您只需要将{{ counts.views + 5}}
更改为{{ counts.views | plus: 5}}