草庐IT

Adding_Extensions_using_the_Windo

全部标签

javascript - 拖放 : How to get the URL of image being dropped if image is a link (not the url of the link)

我有这个代码:functiondrop(evt){evt.stopPropagation();evt.preventDefault();varimageUrl=evt.dataTransfer.getData('URL');alert(imageUrl);}FIDDLE如果你放下元素它会提醒图像的url。到目前为止一切顺利。我的问题是,如果您删除元素它会提醒href的url的元素。我想提醒的网址内的元素就像您在上面的示例中放下图像一样。这可能吗?我不介意使用Jquery或任何其他库。我只想获取中图像的url元素。重点是将其他网站的图片链接拖到我的网站并获取图片的url。为了更清楚地说明

javascript - Breeze 错误 : Illegal construction - use 'or' to combine checks

我遇到了这个Breeze错误[Illegalconstruction-use'or'tocombinechecks]在加载实体的编辑页面时在Chrome上。当我刷新页面时,错误消息不再出现。这个错误在我的网站上随机发生,不定期发生。我无法使用特定场景重现它,只是随机遇到它。我在Breeze代码中看到这条错误消息if(curContext.prevContext===null){curContext.prevContext=context;//justupdatetheprevContextbutdon'tchangethecurContext.returnthat;}elseif(co

javascript - react .js : the most efficient way to pass a parameter to an event handler without bind() in a component

当事件处理程序使用this时(像下面的handleClick一样使用this.setState),你必须将事件处理程序与this关键词。否则,您需要使用thearrowfunction.例如//Thisfunctionisn'tboundwhilstusing"this"keywordinsideofit.//Still,itworksbecauseitusesanarrowfunctionhandleClick=()=>{this.setState({isClicked:true});}render(){return(Click);}但是,使用上述方法,您不能传递参数。您需要使用..

javascript - 在JavaScript事件处理中,为什么 "return false"或 "event.preventDefault()"和 "stopping the event flow"会有区别?

据说当我们处理一个“点击事件”时,返回false或者调用event.preventDefault()是有区别的,其中thedifferenceisthatpreventDefaultwillonlypreventthedefaulteventactiontooccur,i.e.apageredirectonalinkclick,aformsubmission,etc.andreturnfalsewillalsostoptheeventflow.那是不是说,如果click事件被多次注册了好几个action,用$('#clickme').click(function(){…})返回fals

javascript - 错误 : Unexpected value 'FormGroup' declared by the module 'DynamicTestModule'

我们的项目结构如下:Angular2-webpack-starter.我们的项目成功编译、构建并可以在浏览器中看到。这里没有问题。但是当我们尝试使用karma和jasmine运行测试用例时,我们遇到了这个错误。XXXXComponent:heavy_multiplication_x:ShouldMatchCurrentTabas1Chrome55.0.2883(MacOSX10.10.5)Error:Unexpectedvalue'FormGroup'declaredbythemodule'DynamicTestModule'atSyntaxError.ZoneAwareError(w

javascript - Meteor Collection Transform : is it done on the server or on the client? 或者它取决于

我想使用转换从集合中创建一个“虚拟字段”。但是,我添加的新字段(在转换函数中)正在向返回的文档中添加相当多的数据。如果转换发生在客户端内部,这很好。如果在服务器端完成,则会出现带宽问题。所以我想知道转换是在服务器上还是在客户端上完成,还是取决于我如何查找/获取文档? 最佳答案 更新:可以在服务器上进行转换。您可以像这样在客户端进行转换:returnYourCollection.find({},{transform:function(doc){doc.test=true;returntrue;}});Meteor忽略对已发布查询的tr

javascript - AngularJS 指令 : How do I hide the alert using timeout?

昨天,我开始为我的项目编写一个通知指令我在stackoverflow上问了问题AngularJS:Alertsnotshowingup在努力通过文件和videos之后,我能够构建一个基本的通知指令http://plnkr.co/edit/uqSB1gIz6XEmJfC8zHNb?p=preview我想要什么?像任何其他应用程序一样,当警报出现时,它们会在一秒钟左右后隐藏,我试图找到一种方法来在一秒钟后隐藏警报,但不确定该怎么做非常感谢任何帮助更新根据@Derek的回答,我能够实现超时http://plnkr.co/edit/uqSB1gIz6XEmJfC8zHNb?p=preview

javascript - 流: Typechecking a complex Immutable shape using fromJS()?

如何使用Flow对从fromJS生成的Immutable.JS数据结构的形状进行类型检查?可以使用对象字面量符号非常准确地键入普通的旧JSblob:typeObjectShape={a:number,b:string,c:{d:number,},e:Array};constobj:ObjectShape={//hyper-accuratea:1,b:'2',c:{d:3,},e:[4]}但是,在Immutable.js方面,似乎有两个主要的并发症:似乎Immutable.js的fromJS方法返回any(https://github.com/facebook/immutable-js/

javascript - AngularJS 设计模式 : Should I use factories to create constructor functions?

这是我在创建AngularJS应用程序时一直在考虑的问题。当我第一次了解AngularJS工厂时,我认为它们的一个巧妙用法是创建并返回一个构造函数而不是一个普通对象,例如:app.factory("Foo",function(){functionFoo(bar,baz){this.bar=bar;this.baz=baz;...}Foo.prototype={constructor:Foo,method1:function(){...},method2:function(){...},...,methodn:function(){...},};returnFoo;});然后,您可以将该

javascript - Warning : flattenChildren(. ..): Encountered two children with the same key/Child keys must be unique

昨天我将react-router-dom添加到我的项目中,现在当我离开并返回导航中的Sky元素时,它会重新加载天空,我得到Warning:flattenChildren(...):Encounteredtwochildrenwiththesamekey,element-id-50.Childkeysmustbeunique;whentwochildrenshareakey,onlythefirstchildwillbeused.(上面使用的数字50只是一个例子,它每次都会抛出这个错误~40次,所有的id都不同)问题似乎出在我的sky.js文件中:componentWillMount()