如何将属性值传递给胸腺中标准JS功能

发布于 2025-01-28 20:27:05 字数 277 浏览 2 评论 0原文

在我的模板文件中,我使用以下代码

<script type="text/javascript" > 
var ue=UE.geteditor();
ue.ready(function()
{
ue.setcontent("${user.email}");
});
</script>

,我想将UE的内容设置为属于用户的电子邮件,但是将“ $ {user.email}”作为字符串。
在普通JS函数中使用百里叶属性值的正确方法是什么?有什么帮助?

In my template file using thymeleaf I have below code

<script type="text/javascript" > 
var ue=UE.geteditor();
ue.ready(function()
{
ue.setcontent("${user.email}");
});
</script>

I want to set the content of ue to attribute user's email ,but got "${user.email}" as a string instead.
What's the correct way to use thymeleaf attribute value in plain JS function?Any help?Thx.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

您需要使用 script inlining

<script th:inline="javascript">
    let user = {
        email: [[${user.email}]]
    };

    let ue = UE.geteditor();
    ue.ready(function() {
        ue.setcontent(user.email);
    });
</script>

You need to use script inlining.

<script th:inline="javascript">
    let user = {
        email: [[${user.email}]]
    };

    let ue = UE.geteditor();
    ue.ready(function() {
        ue.setcontent(user.email);
    });
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文