gpt4 book ai didi

javascript - 在模板内渲染剑道网格导致错误

转载 作者:行者123 更新时间:2023-11-30 15:33:46 24 4
gpt4 key购买 nike

我使用外部剑道模板。我想在模板中呈现网格。

<script type="text/x-kendo-template" id="template">

<div id="grid"
data-role="grid"
data-columns="[
{ 'field': 'Name', 'attributes': { 'title': '#=Description#' } }
]"
data-bind="source: Items">
</div>

</script>

只要我省略“#”,它就可以工作。如果我包含“#”(在 title 属性的示例中),它会导致无效模板错误。

最佳答案

您必须对 # 进行转义,否则模板引擎将尝试评估该语句。如this doc所示你可以试试这些转义方法:

{ 'title': '\\\\#=Description\\\\#' }

{ 'title': '\\#=Description\\#' }

关于javascript - 在模板内渲染剑道网格导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41893475/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com