草庐IT

get_object_list

全部标签

javascript - 在循环中运行时 undefined object ,但在顺序执行时未定义

我正在使用jQueryMaskedInputplugin使用定义为属性掩码值的数据掩码属性设置所有输入元素:给定这个html:还有这个脚本:$("input[data-mask]").each(function(){varmaskValue=$(this).data('mask');console.log($(this).attr('id')+":"+maskValue);//undefinederrorhereonseconditeration"b:999"//noissuesifyouremovethedata-maskfromoneoftheinputelementsreturn

javascript - 在 Object.create 中使用属性描述符的正确方法是什么?

我在Object.create方法中将一个对象作为第二个参数传递,但出现以下错误:UncaughtTypeError:Propertydescriptionmustbeanobject:1这是错误的代码:vartest=Object.create(null,{ex1:1,ex2:2,meth:function(){return10;},meth1:function(){returnthis.meth();}}); 最佳答案 Object.create(proto,props)有两个参数:proto—theobjectwhichsho

javascript - ES 2017 : async function vs AsyncFunction(object) vs async function expression

我刚刚阅读了有关asyncfunctions的内容,并发现了ES2017的一些类似功能。它造成了很多困惑,我只想问:asyncfunction、AsyncFunction(用于创建异步函数)和异步函数表达式(我认为这只是另一个异步函数)?什么时候应该使用一种格式而不是另一种格式?我们将不胜感激对每个怪癖和表现的强调! 最佳答案 在Javascript中有四种创建函数的方法。在Javascript中也有四种创建异步函数的方法,它们是彼此精确的镜像。为了演示这是如何工作的,我使用了一个简单的sleep函数,全局声明:functionsl

javascript - 如何在 jQuery 中使 $.get() 函数同步?

我想让$.get()方法在我的函数中同步。在ajaxaysnc:false帮助我,现在我如何对$.get()做同样的事情varifsc_code=$('#ifsc-code').val();varapi_url='http://api.techm.co.in/api/v1/ifsc/'+ifsc_code;$.get(api_url,function(data,status){//console.log(data.status);varstatus=data.status;if(data.status=="success"){$.each(data,function(key,value

javascript - 错误信息。 "Props with type Object/Array must use a factory function to return the default value."

我正在使用Vue-Cli3.0。我将此模块用于Vue.js。https://github.com/holiber/sl-vue-tree这是一个可自定义的可拖拽的Vue.js树组件,但我发现它无法复制对象的功能。https://github.com/holiber/sl-vue-tree/blob/master/src/sl-vue-tree.js#L715因为这里。JSON.parse(JSON.stringify(entity))所以我使用了这个模块并编辑了复制功能。https://www.npmjs.com/package/clonevarclone=require('clone

javascript - 为什么使用 this.get ('serviceName' ) 而不是 this.serviceName?

在Ember.JS中,这样做有充分的理由吗:importService,{inject}from'@ember/service';exportdefaultService.extend({ajax:inject(),getAll(){returnthis.get('ajax').request(`api/users/`,{method:'GET',contentType:'application/json'});}});与此相反?importService,{inject}from'@ember/service';exportdefaultService.extend({ajax:in

javascript - SettimeOut 间隔失败,出现 "Cannot convert undefined or null to object"

我正在使用tampermonkey编写用户脚本,但无法解决此错误,我们将不胜感激。我检测到按键很好,空格键会触发此功能,只要按键保持在向下位置,它就会重复自身。控制台正常写入输出大约30秒,然后出现TypeError。根据声誉限制,这是一个屏幕截图:用户脚本://==UserScript==//@nameTESTSTUFF--------------------//@namespacehttp://tampermonkey.net///@version0.1//@descriptiontrytotakeovertheworld!//@authorYou//@run-atdocument

javascript - 如何初始化 firstChild 这样我就不会得到 "x.firstChild is null or not an object"?

在我的JSP/HTML中我有这个:然后在我的javascript部分,我有一个像这样从onclick调用的函数;functionchangeLabel(){exampleLabel.firstChild.nodeValue='LABELHASCHANGED';}这在Chrome中工作正常,在Firefox和IE中什么都不做,页面上出现错误exampleLabel.firstChildisnullornotanobject.好吧,我可以认为没有firstChild,所以尝试做firstChild。任何事情都是NPE,我什至可以认为其他浏览器不会像Chrome那样自己初始化它。问题是,我该

javascript - 未捕获的类型错误 : Object [object Object] has no method 'apply'

我在创建的新网站上收到此UncaughtTypeError,但我无法找出导致该错误的原因。我在下面的链接中重现了这个问题,如果您查看浏览器的JS控制台,您会看到发生了错误,但没有其他任何反应。http://jsfiddle.net/EbR6D/2/代码:$('.newsitem').hover($(this).children('.text').animate({height:'34px'}),$(this).children('.text').animate({height:'0px'}));​ 最佳答案 确保将它们包装在异步回调

javascript - SlickGrid 列选择器 : Setting the default columns to display from a larger list

我目前正在使用SlickGrid并允许用户使用ColumnPicker选择要显示的列。按照http://mleibman.github.com/SlickGrid/examples/example4-model.html的例子我已经能够让它很好地工作。我不确定的下一步是是否可以选择默认的列列表以在首次渲染时显示。例如,假设我有一个包含5列的数组,声明如下:{name:"Name"field:"Name"id:"Name"sortable:trueminWidth:120editor:Slick.Editors.Text},{name:"Address"field:"Address"id