如何显示包含花括号的文本 [英] How to display texts that contain curly braces

查看:39
本文介绍了如何显示包含花括号的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用例如显示 JSON 字符串sap.m.Text?

Is it possible to display a JSON string using e.g. sap.m.Text?

由于字符串 "{...}" 的结构,我很确定它将文本视为绑定语法.

I'm pretty sure it's treating the text as a binding syntax due to the structure of the string "{...}".

我认为可能有一个参数来禁用允许任何类型的原始文本的绑定,但查看 API,我看不到这样的事情.

I thought there may be a parameter to disable binding allowing any kind of raw text, but looking at the API, I see no such thing.

以下是该问题的示例:http://jsbin.com/zarijedaya/1/edit?html,js,output

推荐答案

您可以使用 setText 方法,该方法会将 JSON 视为字符串.

You can make use of the setText method which will consider the JSON as a string.

new sap.m.Text().setText(json);

http://jsbin.com/bonoxavilo/1/edit

这篇关于如何显示包含花括号的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆