Polymer文档建议在操作数组时始终使用polymer数组变异函数。然而,我没有看到一个清空数组的函数。我只看到pop、push、shift、unshift和splice函数。目前,我采用以下方法:
<script>
Polymer({
is: "wc-example",
properties: {
data: { type: Array, value: function () { return [1, 2, 3]; } }
},
ready: function () {
this.data = [];
}
});
</script>
这样操作虽然可以实现功能,但似乎不太合适,因为没有使用数组改变函数。有没有人知道正确的解决方案?
谢谢!