如何使用knockout将“ActiveSellers”计数与“描述”的值绑定?
<div class="detailProductPrice">
"Description"
<a class="compare comparea" data-bind="attr: {'href': '/product/'+ FolderName}" target="_top">COMPARE PRICE</a>
from "ActiveSellers" sellers
</div>
“描述”部分是html。 “ActiveSellers”是一个数字。
答案 0 :(得分:0)
您可以添加空的span元素:
<div class="detailProductPrice">
<span data-bind="html: Description"></span>
<a class="compare comparea" data-bind="attr: {'href': '/product/'+ FolderName}" target="_top">COMPARE PRICE</a>
<span data-bind="text: ActiveSellers"></span>
</div>
或使用没有容器元素的KO绑定
<div class="detailProductPrice">
<!--ko html: Description--><!--/ko-->
<a class="compare comparea" data-bind="attr: {'href': '/product/'+ FolderName}" target="_top">COMPARE PRICE</a>
<!--ko text: ActiveSellers--><!--/ko-->
</div>
答案 1 :(得分:0)
<div class="detailProductPrice">
<!--ko html: Description--><!--/ko-->
<a class="compare comparea"
data-bind="attr: {'href': '/product/'+ FolderName}"
target="_top">COMPARE PRICE</a>
from <!--ko text: ActiveSellers--><!--/ko--> sellers
</div>