我收到错误 <form onsubmit="return confirm('If you enter the incorrect number, the search will still be conducted and charge you for the cost of the search. do you want to continue?.')" action="http:example.com/" id="customersearch" name="customersearch" role="form" method="post" accept-charset="utf-8" novalidate="novalidate">
<input type="submit" value="submit">
</form>
我的代码就是这个
Don't use Ember's function prototype extensions ember/no-function-prototype-extensions
这是我的终端所指的代码行import JSONAPIAdapter from 'ember-data/adapters/json-api';
import $ from 'jquery';
import config from 'appName/config/environment';
export default JSONAPIAdapter.extend({
shouldReloadAll: function() {
return false;
},
shouldBackgroundReloadRecord: function() {
return true;
},
namespace: 'api/v1',
host: window.location.origin,
coalesceFindRequests: true,
headers: function() {
// Reference https://github.com/DavyJonesLocker/ember-appkit-rails/issues/220
// Only set the X-CSRF-TOKEN in staging or production, since API will only look for a CSRF token on those environments
let csrfToken;
if (config.environment === 'staging' || config.environment === 'production') {
csrfToken = $('meta[name="csrf-token"]').attr('content');
}
let authorizationToken = 'Token ' + this.currentSession.get('token');
return {
'X-CSRF-TOKEN': csrfToken,
'Authorization': authorizationToken
};
}.property().volatile(),
handleResponse(status, headers, payload, requestData) {
if (this.isInvalid(status, headers, payload)) {
if (payload && typeof payload === 'object' && payload.errors &&
typeof payload.errors === 'object') {
return payload.errors = [payload.errors];
}
}
return this._super(status, headers, payload, requestData);
}
});
我在谷歌上查了但是我找不到类似的例子。顺便说一句,我已将我的余烬版本从.property().volatile(),
更新为1.13.13
,这就是我收到错误的原因。
请帮帮我
答案 0 :(得分:3)
Ember&#39; .property()
已被弃用。
而不是:
headers: function() {
// ...
}.property().volatile(),
...执行:
headers: computed(function () {
// ...
}).volatile(),
还在顶部添加计算导入:
import { computed } from '@ember/object';
当您看到这些拼图错误时,请在Google搜索规则名称,在本例中为ember/no-function-prototype-extensions
。您将找到错误的描述以及如何修复: