Angel丶守护&雪之源 2022-08-02 16:16 采纳率: 22%
浏览 16
已结题

关于script type="text/template"中if判断的问题

问题遇到的现象和发生背景

script的类型时text/template,如何让指定元素判断当前值是否为空,决定当前元素是否被渲染

问题相关代码,请勿粘贴截图
<template type="template/text" class="template-table-tr">
    <tr>
        <td>
            <div class="product-content">
                <div class="product-thumb">
                    <img fit="contain" alt="{{item_title}}" title="{{item_title}}" width="64" height="64" src="{{thumbnail}}" />
                </div>
                <div class="product-info">
                    <div class="product-info__title">
                        <a href="{{item_url}}">{{item_title}}</a>
                    </div>
                    <!--  如何判断{{item_variation}}是否不为空,决定下面的div是否存在 -->
                    <div class="product-info__attrs">
                        <span>{{item_variation}}</span>
                    </div>
                </div>
            </div>
        </td>
    </tr>
</template>


  • 写回答

1条回答 默认 最新

  • 土拨鼠1号 2022-08-02 18:19
    关注

    img

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 9月9日
  • 修改了问题 8月2日
  • 创建了问题 8月2日

悬赏问题

  • ¥20 python爬虫遇到空文本取不出来
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused
  • ¥20 关于web前端如何播放二次加密m3u8视频的问题
  • ¥15 使用百度地图api 位置函数报错?
  • ¥15 metamask如何添加TRON自定义网络
  • ¥66 关于川崎机器人调速问题
  • ¥15 winFrom界面无法打开
  • ¥30 crossover21 ARM64版本安装软件问题
  • ¥15 mymetaobjecthandler没有进入