data: { suggestionGoodSelect: new Set(), suggestionBadSelect: new Set() }, |
onSuggestionGoodSelect: function (e) { let selectIndex = e.currentTarget.dataset.index; let goodSelect = this .data.suggestionGoodSelect; goodSelect.add(selectIndex); this .setData({ suggestionGoodSelect: goodSelect }) }, |
在goodSelect.add(selectIndex)时报错了提示
goodSelect.add is not a function ; [Component] Event Handler Error @ pages/comment/comment #bound onSuggestionGoodSelect TypeError: goodSelect.add is not a function |
看了下WAService里的处理,Set被当做普通Object来处理了。。里面没有属性,被替换成了{}。。如果要用的话,只要不放到 Page的data里 是可以正常用的。。
add报错了和setData有什么关系