打字稿不运算符不起作用 [英] Typescript not operator not working
本文介绍了打字稿不运算符不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我具有此功能,该功能在更改设置错误消息可见性的multiselect元素后运行:
I have this function that runs after a multiselect element is changed that sets an error message visibility:
getVisibility(multiselect) {
if ((multiselect.selectedCategories.length < 1 && !multiselect.allSelected) && this.submitted) {
return 'visible'
} else {
return 'hidden'
}
}
但是在这一行:
if ((multiselect.selectedCategories.length < 1 && !multiselect.allSelected) && this.submitted)
multiselect.allSelected为false,但!multiselect.allSelected也为false.
multiselect.allSelected is false, but !multiselect.allSelected is also false.
图片1:
图片2:
为什么是! (not)与没有not相同的布尔值?
Why is the ! (not) the same boolean value as without the not?
推荐答案
打字稿无法运行
Typescript not operator not working
最后只是JavaScript,而且绝对可以正常工作. chrome开发工具和/或TypeScript源映射存在问题.
Its just JavaScript in the end and it most definitely works. The issue with the chrome dev tools and / or TypeScript source maps.
我做什么:
- 在控制台中执行命令(可能会撒谎).
- 禁用源地图(更多原因: Chrome Typescript调试参考错误'这个')
这篇关于打字稿不运算符不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文