草庐IT

the_executable

全部标签

javascript - 仅限 Chrome 错误 : Failed to execute 'scroll' on 'Window' : No function was found that matched the signature provided

我只在Chrome中遇到这个错误(在Safari/Firefox中有效):无法在“Window”上执行“scroll”:找不到与提供的签名匹配的函数。代码在内联事件中:我不明白这是什么问题。PS:注意这段代码是我在DOM渲染后得到的输出。实际代码拆分成我在服务器端模板引擎中使用的不同组件/函数,正如下面评论中指出的那样,应避免直接混合此代码。 最佳答案 也许试试scrollTo。这是支持x和y坐标的跨浏览器。http://www.w3schools.com/jsref/met_win_scrollto.asp...

javascript - rails + Chartkick : How to change the date format of the tooltip?

我正在以这种方式生成图表(使用GoogleChart):"Solditems",data:@items.group(:created_at).count}],:library=>{hAxis:{title:"Period"},vAxis:{title:"AmountsinUDS"},title:"HistoryOfSales"}%>图表生成得很好,但有一件事我想改变——工具提示看起来像这样:工具提示中的信息是正确的,但我不想显示Oct19,2014,2:00:00AM我只想显示Oct19,2014。有没有办法用Chartkick做到这一点?非常感谢您的宝贵时间。

javascript - 如何实现 Typescript 异步等待模式 : Where is the Promise

我正在学习Angular和Typescript。我有一个客户服务,在这个服务中我有一个方法,我希望从RESTfull服务返回一组客户。最初我是这样创建我的GetCustomers函数的:publicGetCustomers():Dtos.ICustomer[]{var_customers:Dtos.ICustomer[];this._httpService.get('http://localhost/myTestApi/api/customers/').success(function(data){_customers=dataasDtos.ICustomer[];}).error(f

javascript - Jquery-自动完成 : makes the tab key select the first item if no item is selected

这个问题的目标是:通过使用jquery-autocomplete,使tab键能够在没有选择任何项目的情况下选择第一个项目。我实现的代码(1)有效,但我有一些疑问,我想澄清它们,或者如果可能的话,改进/更改代码(1)以实现我的目标。我的疑问是:我太早触发了ENTER:事件调度是异步的(不同的监听器是同步调用的,但它是异步的触发器),所以我可能会在监听器处理DONE之前触发它。因此,我在这里仍然为两个事件使用相同的对象,所以我可能会产生令人讨厌的副作用(如果我在第一次调度期间阻止默认设置,那么第二个调度也会被阻止,因为它是同一个对象,例如).有什么建议/意见吗?附言:这是jsfiddle链

javascript - 代码挑战 : Create a class Foo that tracks the number of total object instances

我正在尝试解决工作应用程序的代码挑战,但我遇到了困难,非常感谢任何帮助。问题:创建一个Foo类,它有一个名为refCount的方法。在类或其任何实例上调用refCount应该返回存在的实例总数。示例:varf1=newFoo();f1.refCount();//shouldbe1Foo.refCount();//shouldbe1varf2=newFoo();f1.refCount();//shouldbe2f2.refCount();//shouldbe2Foo.refCount();//shouldbe2到目前为止我有这样的事情:functionFoo(){this.refCoun

javascript - 私有(private) NPM : How can the latest version of a module be installed?

使用私有(private)npm,常用命令似乎不起作用:npminstall没有特定的@version::issuenpmoutdated::issuenpmupdate::issuenpmviewversions::(还没有发现问题)还要注意npmv,npmshow,和npminfo是aliases这同样行不通我经常不知道我的团队维护的私有(private)模块的最新版本。我会求助于上面列出的命令之一,但它们似乎不起作用。如何在不知道最新版本的情况下安装软件包? 最佳答案 如果我理解你的问题,安装最新的软件包将是:npminsta

javascript - "Call stack"和 JavaScript 中的 "Execution context stack"一样吗?

我经常在很多文章中看到“调用堆栈”。像这样:https://hackernoon.com/understanding-js-the-event-loop-959beae3ac40#ec22但是在ECMAScript文档中找不到“调用堆栈”。“调用堆栈”是否与“Executioncontextstack”相同? 最佳答案 СallStack和ExecutionStack是同一事物的不同名称。它是一个LIFO堆栈,用于存储在代码执行期间创建的执行上下文。维基百科说:“这种堆栈也称为执行堆栈、程序堆栈、控制堆栈、运行-时间堆栈,或机器堆栈

javascript - 使用: and => for the return type with a TypeScript function?有什么区别

我有以下代码:///functionaddThemePrototypes(){vartemplateSetup=newArray();$.fn.addTemplateSetup=function(func,prioritary){if(prioritary){templateSetup.unshift(func);}else{templateSetup.push(func);}};}有人能告诉我为什么要用=>void来声明吗?interfaceJQuery{addTemplateSetup:(func:Function,priority:bool)=>void;}我想我对如何从java

javascript - 未捕获的类型错误 : Failed to execute 'observe' on 'MutationObserver' : parameter 1 is not of type 'Node'

所以我下面的代码在jsfiddle中独立运行。但出于某种奇怪的原因..在将它推送到实时服务器后,我一直收到此错误:/我无法弄清楚为什么......错误:mycodewitherror.js:23UncaughtTypeError:Failedtoexecute'observe'on'MutationObserver':parameter1isnotoftype'Node'.js:$(document).ready(function(){//Thebelowcollectsuserloginname,newlogindateandtime,andprevioususeURLvarelem

javascript - react : componentDidMount + setState not re-rendering the component

我对使用componentDidMount和setState来使用react并努力更新自定义组件相当陌生,这似乎是推荐的做法。下面是一个示例(包括用于获取数据的axiosAPI调用):importReactfrom'react';import{MyComponent}from'my_component';importaxiosfrom'axios';exportdefaultclassExampleextendsReact.Component{constructor(props){super(props);this.state={data:[]};}GetData(){returnax