【发布时间】:2017-02-06 07:48:57
【问题描述】:
我正在使用knockout js来绑定我表中的链接列表这里是代码
<table class="table table-bordered">
<thead>
<tr>
<th style="width:10%;">#</th>
<th style="width:50%;">Link</th>
<th style="width:20%;">Active</th>
<th style="width:20%;">Action</th>
</tr>
</thead>
**<tbody data-bind="foreach:LinkList">**
<tr>
<td data-bind="text:$index()+1"></td>
<td><span data-bind="text:$data.LinkName.length <= 40 ? $data.LinkName : $data.LinkName.substring(0, 40) + '...'"></span></td>
<td>
<input type="checkbox" data-bind="checked:$data.IsActive" disabled />
</td>
<td>
<button class="btn btn-xs btn-primary" type="button" title="Edit"
data-bind="click:$parent.OnClickEditBtn">
<span class="glyphicon glyphicon-edit"></span>
</button>
<button class="btn btn-xs btn-danger" type="button" title="Delete"
data-bind="click:$parent.OnClickDeleteBtn">
<span class="glyphicon glyphicon-trash"></span>
</button>
</td>
</tr>
</tbody>
</table>
这里我使用了foreach来绑定链接列表以显示在HTML页面上 我还附上了该页面的链接 http://growingtab.com/links
但是当您检查页面源代码中的 html 页面时,链接没有显示在其源代码中? 那么我怎样才能在页面源中显示这些链接呢? 有什么办法可以显示吗?
【问题讨论】:
-
请帮忙还是没有任何反应
-
你能分享你的视图模型吗?
-
我认为没有办法做到这一点。源头就是源头。为什么首先需要它们出现在源代码中?如果您只需要访问者能够看到他们的代码,您可能可以在呈现页面的另一个部分中显示链接。
标签: javascript jquery html knockout.js rendering