由于我的搜索是不够的我的问题,我在这里张贴有关于如何正确使用一些澄清v-if
,并v-else
在<td>
在VUE在HTML表格标记。
//given the value of this.property is name
<tr>
<td v-if="this.property == 'name'">I'm name</td>
<td v-else>No I'm not</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我的问题是,即使我的this.property
值是'name'
或不是a'name'
它总是符合v-else
条件,并且v-if
不会被执行。我想要的输出是执行v-if
如果this.property
值是'name'
,v-else
如果不是。
我这样做是正确的吗?我在这里需要你的指导。
删除this
指针。你不需要它。
//given the value of this.property is name
<tr>
<td v-if="property === 'name'">I'm name</td>
<td v-else>No I'm not</td>
</tr>
Run Code Online (Sandbox Code Playgroud)