在Vue中,可以使用v-if指令来判断列表中的plantime是否为空。以下是一个示例代码:

<template>
  <div>
    <ul>
      <li v-for="item in list" :key="item">
        <span v-if="item.plantime">{{ item.plantime }}</span>
        <span v-else>Plantime is empty</span>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        { plantime: null, temperature: null },
        { plantime: "2021-10-01", temperature: 25 },
        { plantime: null, temperature: null },
      ],
    };
  },
};
</script>

在上面的示例代码中,我们使用v-if指令来判断item.plantime是否为空。如果不为空,就显示plantime的值;如果为空,就显示"Plantime is empty"

plantime null temperature null如何在vue里判定该列表的plantime是否为空

原文地址: http://www.cveoy.top/t/topic/hLjv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录