草庐IT

after_update

全部标签

javascript - jQuery "after-click"事件

我有一个在iframe中打开的链接列表,例如:单击链接后我需要更新另一个div。具体来说,我需要调用一个函数来检查框架的src属性并更新div。如果我这样做:$("#frameTriggera").click(function(){variframe=$("iframe[name=iframe1]").get(0);console.log(iframe.contentWindow.location.href);//theproblemhereisthatthattheiframe.window.locationwill//changeAFTERthisfunctionreturns})

javascript - jQuery 的 after 方法不适用于新创建的元素

据我所知,下面的代码应该可以工作,创建一个元素,然后创建一个元素;该表达式应生成一个包含两个元素的jQuery对象:$("firstelement'scontent").after("secondelement'scontent");然而,我得到的却大不相同。Thedocumentation(参见标题“插入断开连接的DOM节点”)告诉我上面的代码应该生成一个jQuery对象,抓取两个HTML片段并构建两个DOM元素。但是,在1.4以上的几个不同版本的jQuery中,我得到的是一个只有1个节点的jQuery对象。然而,下面的代码工作得很好,返回(我相信是)正确的jQuery对象,里面有两

javascript - 引用错误 : You are trying to `import` a file after the Jest environment has been torn down

我有一个组件使用来自ReactNative的Animated组件。我开始编写一个测试用例来模拟组件的onPress,它调用一个函数,其中包含Animated.timing和setState。运行jest工作正常,但测试永远不会停止运行,而且我之前编写的一个不相关的测试用例现在似乎从未通过(之前通过)。运行jest--watch,我得到这个错误:ReferenceError:Youaretryingto`import`afileaftertheJestenvironmenthasbeentorndown.atFunction.bezier(node_modules/react-nativ

javascript - 缺少 : after property ID

我不明白我在这里做错了什么...第3行报告丢失:在属性ID之后$(document).ready(function(){$('#imagegalleryimg').each(function({$(this).css({width:'100%'});});$('#imagegallery').cycle({timeout:0,fx:'scrollHorz',width:'100%',height:'auto',next:'.next',prev:'.prev'});$("#imagegallery").touchwipe({wipeLeft:function(){$("#imagega

javascript - Webkit 错误 : Overflow auto triggered after resizing a child element to matching size

我有以下简单设置:document.getElementById('inner').addEventListener('click',({target})=>{target.classList.add('match');});#container{background:green;overflow:auto;width:200px;height:100px;}#inner{width:210px;height:110px;}#inner.match{width:200px;height:100px;}单击内部元素后,我希望父元素上的滚动条消失,因为这两个元素现在具有匹配的大小。这在Fi

javascript - react + 终极版 : Component does not update

尝试使用React+Redux,并且可能正在做一些明显愚蠢的事情,因为触发操作以通过网络获取数据的组件在获取数据时不会得到更新(重新呈现)。这是我的代码的相关部分:作为应用程序入口点的顶级index.js:importReactfrom'react';importReactDOMfrom'react-dom';import{Provider}from'react-redux';import{createStore,applyMiddleware}from'redux';import{Router,browserHistory}from'react-router';importredux

javascript - 这个错误 "Declaration of instance field not allowed after declaration of instance method."是什么意思

在我的Angular2项目中,我收到此错误:“在声明实例方法之后不允许声明实例字段。相反,这应该出现在类/接口(interface)的开头。(成员排序)”我想了解如何解决这个问题以及我为什么会遇到这个问题。错误与下一段代码中的私有(private)函数有关:exportclassHomeComponentimplementsOnInit{publicerror:string;publicshirts=[];constructor(publicrest:RestService,publicscService:ShoppingCartService,publicsnackBar:MdSna

javascript - react 中的 "Cannot update during an existing state transition"错误

我正在尝试执行本ReactJS教程的第15步:React.jsIntroductionForPeopleWhoKnowJustEnoughjQueryToGetBy作者推荐如下:overflowAlert:function(){if(this.remainingCharacters()Oops!TooLong:);}else{return"";}},render(){...{this.overflowAlert()}...}我尝试执行以下操作(我觉得没问题)://initialized"warnText"inside"getInitialState"overflowAlert:func

javascript - 错误 : attempted to update component that has already been unmounted (or failed to mount)

我是React的新手,由于这个错误,我无法呈现我的应用程序。由于尝试在卸载时设置状态,我试图呈现为元素的数据似乎不会呈现?我不确定我是怎么得到这个错误的,因为我正在componentDidMount中设置Data的状态。我该如何解决这个问题?error:attemptedtoupdatecomponentthathasalreadybeenunmounted(orfailedtomount)classProfileextendsReact.PureComponent{staticpropTypes={navigation:PropTypes.object,handleLogout:Pr

javascript - 如何在 sequelize 中将 .update() 值设置为 NULL

我正在编写我的服务以使用PostGres的sequelize更新行。当我使用PSequel尝试我的查询时,它工作正常:UPDATE"test_table"SET"test_col"=NULLWHERE"id"='2'但是使用sequelize会抛出500错误:db.TestTable.update({testCol:NULL},{where:{id:id}}).then((count)=>{if(count){returncount;}});我的模型确实允许空值,我相信这是允许空值成为默认值和设置的原因:testCol:{type:DataTypes.INTEGER,allowNull