odoo xml t-value = html标签

问题描述 投票:0回答:1

我想将t值的html标签发送为:

<template id="module.content">
  <div>
    <t t-value="img_src"/>
  </div>
</template>

<template id="module.content1">
  <t t-set="img_src" t-value="<img src='module/static/img/image01.png' alt=''/>"/>
  <t t-call="module.content"/>
</template>

但是我得到一个错误

lxml.etree.XMLSyntaxError: Unescaped '<' not allowed in attributes values, line 109, column 37

有什么方法可以发送t值的html标签

xml odoo
1个回答
0
投票
看起来像语法错误?

<t t-set="img_src" t-value="<img src='module/static/img/image01.png' alt=''/>"/>

应该是

<t t-set="img_src" t-value="<img src='module/static/img/image01.png' alt='' "/>

© www.soinside.com 2019 - 2024. All rights reserved.