在vue中使用forEach
今天在vue中使用forEach的时候出现了一些问题:
Object.keys(this.$route.query).forEach((key) => {
console.log(this.$route.query[key]);
//这个this是指向undefined,因为vue是使用严格模式
// console.log(this);
});
今天在vue中使用forEach的时候出现了一些问题:
Object.keys(this.$route.query).forEach((key) => {
console.log(this.$route.query[key]);
//这个this是指向undefined,因为vue是使用严格模式
// console.log(this);
});