更改时删除数组中的所有内容并在其中添加新值
这个问题在这里已经有了答案:
  在推送新值之前,您需要清除数组。  清除所有现有值的简单方法是将长度设置为0 : 
saveSelectedValue : function (e) {
    var that = e.data.that,
    selectArray = that.filterSelectedCategories;
    selectArray.length = 0; // clear selectArray array
    selectArray.push($('.posts-filter-cat').val());
    console.log(selectArray);
},
上一篇: On change delete everything in array and add new values in it
