查漏补缺——说说三目运算符
作者:互联网
问题
如题所示
答案
相关源码:
const getters = {
loading: state => state.loading,
runTimeInterval: state => state.runTimeInterval,
notice: state => state.websiteInfo?state.websiteInfo.notice:''
}
这里有一行关于三目运算符的代码:
notice: state => state.websiteInfo?state.websiteInfo.notice:''
根据上面,这句话的意思是当state.websiteInfo
为真时,执行state.websiteInfo.notice
,否则执行''
。
标签:查漏,loading,notice,运算符,state,三目,websiteInfo 来源: https://www.cnblogs.com/Huang-zihan/p/16450068.html