聚合物1.0-如何绑定html值 [英] Polymer 1.0 - How to bind html value

查看:68
本文介绍了聚合物1.0-如何绑定html值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目列表,其中每个项目都有一个.content html值,如下所示.

I have a list of items in which each item has a .content html value as following.

  <template is="dom-repeat" items="{{entries}}">
    <li><p class="paper-font-body2">{{item.title}}</p>
      <div>{{item.content}}</div></li>
  </template>

content字段有点像这样

content field is somewhat like this

  Hello <strong>Polymer</strong>

它在浏览器中显示为纯文本.如何将其显示为安全的html?

It shows in browser as plain text. How do I show it as safe html?

已提出,但这对我没有帮助.

this issue is raised, but it doesn't help me.

推荐答案

您可以轻松做到:

<template is="dom-repeat" items="{{entries}}">
    <li><p class="paper-font-body2">{{item.title}}</p>
      <div inner-h-t-m-l="{{item.content}}"></div></li>
  </template>

这就是我正在使用的,要记住XSS漏洞是开放的.

That's what I'm using, bearing in mind that XSS vulnerability is open.

这篇关于聚合物1.0-如何绑定html值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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