iview中表格根据条件渲染3 判断

 

 

{
          title: "领取 / 总数",
          render: (h, params) => {
            let resultStr = "";
            if (params.row.usedQuantity == null) {
              resultStr = "0";
            } else {
              resultStr = params.row.usedQuantity;
            }
            return h("div", [
              h(
                "span",
                {
                  style: { color: "#555555" }
                },
                resultStr + " / " + params.row.quantity
              )
            ]);
          }
        }
{
          title: "状态",
          width: 90,
          render: (h, params) => {
            let resultStr = "";
            switch (params.row.status) {
              case "1":
                resultStr = "未上架";
                break;
              case "2":
                resultStr = "上架";
                break;
              case "3":
                resultStr = "下架";
                break;
            }
            return h("div", [
              h(
                "span",
                {
                  style: { color: "#555555" }
                },
                resultStr
              )
            ]);
          }
        }

 

相关文章:

  • 2021-08-23
  • 2022-12-23
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-09-02
  • 2021-08-06
猜你喜欢
  • 2021-12-06
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-04-17
相关资源
相似解决方案