在编译时候报‘Property 'filter' does not exist on type 'Element'.’的错,但是在浏览器中运行正常。如下图:
经过不懈的努力,终于找到了原因。是因为tslint检查时不知道this.$refs.tree的类型,因此才报这个错。只要用ts的类型断言给他指定类型就不会报错了。
在编译时候报‘Property 'filter' does not exist on type 'Element'.’的错,但是在浏览器中运行正常。如下图:
经过不懈的努力,终于找到了原因。是因为tslint检查时不知道this.$refs.tree的类型,因此才报这个错。只要用ts的类型断言给他指定类型就不会报错了。
转载于:https://www.cnblogs.com/ziyoublog/p/11447624.html