比如说我想在js中取出所有checked属性为true的对象,我试了filter他说没有这个函数。
getCheckedFiles: state => { return state.files.filter(checked => checked.done) }
Uncaught TypeError: state.files.filter is not a function

我猜原因应该是files是一个对象而不是一个数组,上面是这个files的打印结果
请问我如何取出所有checked属性为true的对象?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
试试改成
另附 Array.prototype.filter()
给你个自写的filter:
所有的?看你的代码,我只看到一个。