Cannot read property 'disabled' of null 问题解决

使用vue-element框架的后台管理项目一直报Cannot read property ‘disabled’ of null 问题,截图如下:
Cannot read property 'disabled' of null 问题解决
1. 问题定位

看了下代码,找了很多解决方案,最后发现是因为注释了el-dropdown-menu下的代码,如下:

Cannot read property 'disabled' of null 问题解决
因为不需要显示右上角图标,所以把那一部分代码注释了。引起了一直报上述错误,在页面中使用了el-dropdown,但是在这个标签里面没有设置它的子元素,所以会报错。

2. 解决方案

el-dropdown中添加el-dropdown-menu标签就可以不再报错了,如下:
Cannot read property 'disabled' of null 问题解决