流体 - 检查值是否为NULL的条件不起作用

Bla*_*ack 2 fluid

只有当属性的fileEn值为NULL(fileEn => NULL)时,我才尝试输出我的元素

<f:if condition="{file.fileEn}==NULL">
    <f:debug title='file'>{file}</f:debug>
</f:if>
Run Code Online (Sandbox Code Playgroud)

但是这也显示了fileEn不在的元素NULL!

Bla*_*ack 5

你不能检查是否有NULL这样的东西,它的工作原理如下:

仅当属性为NULL时才渲染:

<f:if condition="{file.fileEn}">
    <f:then>

    </f:then>
    <f:else>
        <!-- Property is NULL -->
        <f:debug title='file'>{file}</f:debug>
    </f:else>
</f:if>
Run Code Online (Sandbox Code Playgroud)

仅当属性不为NULL时才渲染:

<f:if condition="{file.fileEn}">
    <!-- Property is not NULL -->
    <f:debug title='file'>{file}</f:debug>
</f:if>
Run Code Online (Sandbox Code Playgroud)