我正在尝试绑定按钮是计算属性active
还是disabled
计算属性,但之后会收到此弃用警告和错误。
这是一个麻烦的按钮(此处为 Ember 1.11.1):
<button {{ action 'loadMore' }} {{if canLoadMore 'active' 'disabled'}}>Load More Posts...</button>
此警告和错误:
DEPRECATION: Returning a string of attributes from a helper inside an element is deprecated.
Uncaught TypeError: Cannot read property 'replace' of undefined
关于这个功能:
if (value) {
Ember['default'].deprecate('Returning a string of attributes from a helper inside an element is deprecated.');
var parts = value.toString().split(/\s+/);
for (var i = 0, l = parts.length; i < l; i++) {
var attrParts = parts[i].split('=');
var attrName = attrParts[0];
var attrValue = attrParts[1];
attrValue = attrValue.replace(/^['"]/, '').replace(/['"]$/, '');
env.dom.setAttribute(domElement, attrName, attrValue);
}