- vue版本:2.5.1
代码:
filters: {
nameHighLight (item) {
console.log('_____+++++++', this);
}
}
结果是:
难道在filters是无法获取this
的?
代码:
filters: {
nameHighLight (item) {
console.log('_____+++++++', this);
}
}
结果是:
难道在filters是无法获取this
的?
console.log
的表现行为是异步的,
所以需要这样
filters: {
nameHighLight (item) {
var _this = this;
console.log('_____+++++++', _this);
}
}
mark一下,自己的错误
https://github.com/vuejs/vue/...
10 回答11.7k 阅读
2 回答3.2k 阅读✓ 已解决
4 回答4.6k 阅读✓ 已解决
4 回答2.1k 阅读✓ 已解决
4 回答2.2k 阅读✓ 已解决
3 回答1.2k 阅读✓ 已解决
3 回答5.1k 阅读
尤大亲自回答:
https://github.com/vuejs/vue/...