基本上我试图将可视化添加到删除操作中。
代码即时使用:
{{#each wrappedRecords as |record|}}
{{#fade-element}}
{{record.name}}
<span class="remove" {{action "removeRecord" record}}></span>
</span>
{{/fade-element}}
{{/each}}
因此,正在触发removeRecord操作,并从 wrappedRecords
中删除记录现在在我的 fade-element 组件包装器中。我在willDestroyElement
hook中捕获组件destroy。
export default Ember.Component.extend({
willDestroyElement : function () {
var clone = this.$().clone();
clone.insertAfter(this.$());
clone.fadeOut();
},
});
然而,当我替换时它不起作用:
带有clone.insertAfter(this.$());
的 clone.insertAfter(this.$().parent());
它确实有效,但随后又出现了一个新问题。 E.g:
我有2个项目,我尝试删除它看起来像这样的第一个
X1(删除)X2(第二个元素)X1(被追加到父母的克隆)
链接到现场演示
答案 0 :(得分:1)
所以有两件事:
解决方案是