- 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/...
13 回答12.8k 阅读
7 回答2k 阅读
9 回答1.7k 阅读✓ 已解决
6 回答1k 阅读
3 回答1.1k 阅读✓ 已解决
3 回答1.4k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
尤大亲自回答:
https://github.com/vuejs/vue/...