使用三目判断什么时候使用接口,实现一个请求实现两个功能

    /* 保存编辑 */
    save() {
          const url =
            this.isUpdate == false
              ? "admin-api/sessions-config/add"
              : "admin-api/sessions-config/update";
          this.$http
            .post(url, this.form)
            .then(res => {
              if (res.data.status === 1) {
                this.$message({ type: "success", message: "成功" });
              }
            })
            .catch(e => {
              this.$message.error(e.msg);
            });
    },
posted @ 2021-12-03 14:35  喜欢Tb  阅读(16)  评论(0)    收藏  举报  来源