Modal模板字符串练习

function active(val, item) {
  Modal.confirm({
    title: `您确定要${val ? "激活" : "关闭"}${item.name}吗?`,
    okText: "确定",
    cancelText: "取消",
    onOk: () => {
      editApiVersion({ id: item.id, isActivation: val })
        .then((res) => {
          if (JSON.stringify(res) !== "{}") {
            message.success("修改成功!");
            getInfo({
              ApiTemplateId: props.drawerData.id,
              VersionType: VersionType.value,
            });
          } else {
            message.error("修改失败");
            // openNotificationWithIcon('error', '提示')
          }
        })
        .catch((err) => {
          message.error("修改失败");
          // openNotificationWithIcon('error', '提示')
          console.log(err);
        });
    },
  });
}

function delEvent(record) {
  Modal.confirm({
     title: h("div", {}, "是否要删除【", [
      h(
        "b",
        { style: "color: red" },
        record['name']
      ),
      h("span", "】"),
    ]),
    okText: "确定",
    cancelText: "取消",
    onOk: () => {
      delRole({ id: record.id })
        .then((res) => {
          message.success("删除成功");
          objArray.pagination.current =
            dataSource.value.length === 1 && objArray.pagination.current !== 1
              ? objArray.pagination.current - 1
              : objArray.pagination.current;
          getTableData(objArray.searchParams);
        })
        .catch((err) => {});
    },
  });
}

猜你喜欢

转载自blog.csdn.net/qq_46617584/article/details/131398444
今日推荐