我正在尝试使用自动递增表单中的 tabindex 属性的混合来显示表单。
import Ember from 'ember';
const {
computed,
Mixin
} = Ember;
export default Mixin.create({
baseTabIndex: 0,
tabindex: computed('baseTabIndex', function() {
this.incrementProperty('baseTabIndex');
return this.get('baseTabIndex');
}).volatile()
});
在模板中,我会这样使用它:
{{input value=foo tabindex=tabindex}}
{{input value=bar tabindex=tabindex}}
我认为 volatile 意味着该值未被缓存,所以我会得到 1、2 作为值。但它始终为 1。我如何使用计算属性执行此操作?
最佳答案
我认为您正在寻找的是 class-based helpers .您可能无法重置该值,因此请留意其他解决方案。
关于javascript - 在 Ember 模板中增加 tabindex 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33288172/