草庐IT

properties_container

全部标签

javascript - 未捕获的类型错误 : Cannot read property 'toUpperCase' of undefined react state item

我是React和Javascript的新手,我正在尝试呈现以下React组件:'usestrict';varReact=require('react');importToReadListfrom'./toreadlist.js';varToRead=React.createClass({getInitialState:function(){return{bookTitles:[]};},handleSubmit:function(e){e.preventDefault();this.state.bookTitles.push(React.findDOMNode(this.refs.bo

javascript - 类型错误 : Cannot create property 'FOO' on string 'BAR'

我们应用程序中的错误(现已修复)代码触发了此错误:TypeError:Cannotcreateproperty'FOO'onstring'BAR'但是Javascript完全允许在字符串变量上设置自由属性。我刚刚在Chrome控制台中尝试过:'BAR'.FOO='hello''BAR'['FOO']='hello'而且效果很好。那么JS解释器在什么情况下会触发这个错误?原始代码是用Typescript编写的,然后用Babel转译。这是一个运行时错误。我认为这与typescript无关,因为其他人报告了类似的运行时错误,例如。here和here 最佳答案

javascript - 在 TSX 文件 : Property 'createRef' does not exist on type 'typeof React'

我需要组件的引用。刚刚从jsx转移到tsx并找不到解决这个问题的方法。其他解决方法是使用查询选择器,但我认为这不是做react的好方法。这里是构造函数constructor(props){super(props);this.state={data:initialData,showNewListForm:false,whichButtonClicked:undefined,background:props.background||"#23719f"};this.divContainerRef=React.createRef();console.log("kanbanreference:"

docker login x509: cannot validate certificate for because it doesn‘t contain any IP SANs

dockerlogin私有harbor仓库时,报错,如下:Errorresponsefromdaemon:Get"https://x.x.x.x:443/v2/":x509:cannotvalidatecertificateforx.x.x.xbecauseitdoesn'tcontainanyIPSANsSAN是 subjectAltName的缩写。我们在生成证书的时候未指定这项的配置或者指定错误。参考下面两个链接去生成的证书:ConfigureHTTPSAccesstoHarbor docker-repository-certs其中有一个配置为:cat>v3.ext如果我们配置不是域名,而

javascript - 未捕获的类型错误 : Cannot read property 'document' of undefined

我有以下功能,在我测试过的几台PC上运行良好。我已经在Chrome、IE和Firefox上测试过,没有任何问题。但是,有一台特定的PC(运行Chrome)在该行抛出此错误“UncaughtTypeError:Cannotreadproperty'document'ofundefined”:win.document.write(data);难道是因为win为null?如果是这样,为什么这台特定PC会出现这种情况?是否有一些Chrome设置需要设置?方法:functionviewReport(){console.info('generatingeventreport');varfrmDat

javascript - react : TypeError: Cannot read property 'propTypes' of undefined

请我为以下reactjs页面编写一个单元测试。exportdefaultclassCollapsibleextendsReact.Component{staticpropTypes={title:React.PropTypes.string,children:React.PropTypes.any,};render(){const{title}=this.props;return({title}{this.props.children});}}跟着啧啧Here我在下面写了我的测试describe('Collapsible',()=>{it('works',()=>{letrendere

javascript - [Vue 警告] : Error in render function: "TypeError: Cannot read property ' first_name' of null"

我有以下Navigation.vue组件:{{user.first_name}}import{mapActions,mapGetters}from'vuex'exportdefault{name:'hello',methods:{...mapActions(['myAccount'])},mounted:function(){if(localStorage.getItem('access_token')){this.myAccount()}},computed:{...mapGetters(['user'])}}此代码返回:[Vuewarn]:Errorinrenderfunction

javascript - 对于不区分大小写的 jQuery :contains selector?,有什么方法可以加快此解决方案的速度

我找到了thissolution对于StackOverflow上不区分大小写的jQuery:contains选择器。它工作得很好,但它是以性能为代价的。还有其他人觉得这个解决方案有点慢吗?我正在使用:contains选择器来搜索表格。用户在文本框中键入搜索字符串。对于每次击键,它都会在表中搜索该字符串,并通过:contains选择器仅显示包含该字符串的行。在实现不区分大小写的解决方案之前,此搜索快速而活泼。现在有了这个解决方案,它会在每次击键后短暂锁定。关于如何加快此解决方案的任何想法? 最佳答案 我在Google上找到了另一种不区

javascript - 未捕获的类型错误 : Cannot read property 'offsetWidth' of null

这个问题在这里已经有了答案:GoogleMAPAPIUncaughtTypeError:Cannotreadproperty'offsetWidth'ofnull(26个答案)OffsetWidthnullorundefined(Can'tfindsolution)[closed](1个回答)关闭8年前。不幸的是,我在发布这个问题之前阅读了几个线程,我找不到适合我的问题的答案。这是我的代码片段-->functionpopulateIframe(id){varifrm=document.getElementById(id);ifrm.src="business_data_to_excel

c# - JavaScript 运行时错误 : Unable to get property 'msie' of undefined or null reference

我刚刚尝试更改我对母版页的jqueryui引用。我只在InternetExplorer上收到上述错误。我在Firefox和Chrome上没有收到错误。这是抛出错误的jquery代码:returna.browser.msie?(b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),b我有下面的母版页:请让我知道我需要做什么?我尝试将jquery引