首页 > 解决方案 > ./watch 主要是在编译 JS 库文件,但它总是在缓存一个文件

问题描述

即使我正在进行更改,我也在使用 Ember,但是当我运行 ./watch 时,它不会使用新代码生成 JavaScript 文件 - 这很烦人 - 我正在手动更改,但这不是正确的解决方案吗?即使在文件夹中打开并手动更新了 ember 文件上的代码,我也对文件进行了更改 - 仍然在 app.js 文件中编写旧代码。

可能是什么原因?我正在使用 Web Pack 运行 ./watch 并生成 app.js 文件。

这是我的 Ember js 代码:

export default () => { 
 IMS.registerController("case.details.assignedinspector.edit", {

    caseDetails: Ember.inject.controller('caseDetails'),
    caseId: Ember.computed.alias('caseDetails.model.imscase.id'),
    clearForm: function () {
        $('.modal').modal('hide');
    },
    actions: {
        close: function (id) {
            $('.modal').modal('hide');
            this.transitionToRoute('case.details');
        },

        async save() {
            var scope = this;

            //validating form
            if ($("#edit-assignedinspector-form").validate()) {
                var data = {                    
                    AssignedToInvestigators: Ember.get(scope, 'model.imscase.assignedToInvestigators'), //AssignedToInspectorId: $("#assignedInspectorSelect").chosen().val(),
                    CaseId: this.get('caseId')
                };
                try {
                    let response = await this.api('Case/UpdateAssignedInvestigators').post(data);
                    $('.modal').modal('hide');
                    toastr.success("Assigned Inspector Edit Saved.");
                    scope.transitionToRoute("case.details");
                    scope.get('caseDetails').refreshData();
                    scope.clearForm();
                } catch (ex) {
                    toastr.error("Error saving Assigned Inspector.");
                }
            }
            else {
                toastr.warning("Please fix the form", "Validation failed");
            }
        },
        didInsert: function () {
            $('#edit-assignedinspector-modal').modal();
        }
    }
}); 
 }

以下是它如何在 app.js 文件中生成旧代码:

  save: function () {
    var _save = _asyncToGenerator(
    /*#__PURE__*/
    regeneratorRuntime.mark(function _callee() {
      var scope, data, response;
      return regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              scope = this; //validating form

              if (!$("#edit-assignedinspector-form").validate()) {
                _context.next = 19;
                break;
              }

              data = {
                AssignedToInspectorId: $("#assignedInspectorSelect").chosen().val(),
                CaseId: this.get('caseId')
              };
              _context.prev = 3;
              _context.next = 6;
              return this.api('Case/UpdateAssignedInspector').post(data);

            case 6:
              response = _context.sent;
              $('.modal').modal('hide');
              toastr.success("Assigned Inspector Edit Saved.");
              scope.transitionToRoute("case.details");
              scope.get('caseDetails').refreshData();
              scope.clearForm();
              _context.next = 17;
              break;

            case 14:
              _context.prev = 14;
              _context.t0 = _context["catch"](3);
              toastr.error("Error saving Assigned Inspector.");

            case 17:
              _context.next = 20;
              break;

            case 19:
              toastr.warning("Please fix the form", "Validation failed");

            case 20:
            case "end":
              return _context.stop();
          }
        }
      }, _callee, this, [[3, 14]]);
    }));

    function save() {
      return _save.apply(this, arguments);
    }

    return save;
  }()

它应该调用 Case/UpdateAssignedInvestigators,而不是它仍然调用 Case/UpdateAssignedInspector,这是不正确的。

标签: asp.netember.js

解决方案


推荐阅读