gpt4 book ai didi

kendo-ui - 将值传递给 kendoWindow 模板

转载 作者:行者123 更新时间:2023-12-02 19:04:24 31 4
gpt4 key购买 nike

给定以下模板和函数,如何传递函数参数 contentText 以在模板 #password-validation 占位符 ### 处显示

模板

<script id="password-validation" type="text/x-kendo-template">
<p style="font-size: 12px; padding: 10px">
###
</p>
<div style="text-align: right">
<button class="password-ok k-button">OK</button>
</div>
</script>

函数

function PasswordValidation(contentText) {

var kendoWindow = $("<div />").kendoWindow({
actions: ["Close"],
title: "Password validation",
resizable: false,
modal: true
});

kendoWindow.data("kendoWindow")
.content($("#password-validation").html())
.center().open();

kendoWindow
.find(".password-ok")
.click(function () {
kendoWindow.data("kendoWindow").close();
})
.end()
}

最佳答案

解决方案如下:

<script id="password-validation" type="text/x-kendo-template">
<p style="font-size: 12px; padding: 10px">
#=data#
</p>
<div style="text-align: right">
<button class="password-ok k-button">OK</button>
</div>
</script>

及功能:

function PasswordValidation(contentText) {
var kendoWindow = $("<div />").kendoWindow({
actions: ["Close"],
title: "Password validation",
resizable: false,
modal: true
});

var template = kendo.template($("#password-validation").html());
kendoWindow.data("kendoWindow")
.content(template(contentText))
.center().open();

kendoWindow
.find(".password-ok")
.click(function () {
kendoWindow.data("kendoWindow").close();
})
.end()
}

关于kendo-ui - 将值传递给 kendoWindow 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33914760/

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