如:{"9":1,"10":2}
转换成:[1,2]
把每个属性的值给单独提出来化成数组
console.log(JSON.stringify(this.setmes));//this.setmes={"9":1,"10":2}
                var arr = []
                for (let i in this.setmes) {
                    arr.push(this.setmes[i]); //属性
                    //arr.push(obj[i]); //值
                }
                console.log(JSON.stringify(arr));//打印arr=[1,2]
                
- 本文标题: 如何把JSON对象里面的值转换数组
- 文章分类:【VueJS】
- 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.
- 下一篇: Vue数据列表点击链接弹窗播放视频资源