草庐IT

function-signature

全部标签

javascript - jQuery .fn 表示 "not a function"

当我调用这个自定义函数时$.fn.inputBoxHelper=function(){varargs=arguments[0]||{};varmatchingElem=$.grep(this,function(e){return$(e).val()==$(e).attr('title');});$(matchingElem).addClass(args.className);this.bind({focus:function(){if($(this).val().trim()==$(this).attr('title')){$(this).val(emptyString).remove

javascript - JQuery .on ("click", function() ) 不起作用

我试图在选中复选框时触发JQuery。起初我意识到我的JQuery只适用于静态元素。我通读了几篇文章,发现我需要.on("click,function())才能为动态添加的元素触发同一段javascript。但是,这个方法对我还是行不通。谁能帮忙?谢谢你。$(document).ready(function(){$("input[name='todo']").on('click',function(){varisChecked=this.checkedif(isChecked==true){$(this).next().remove();$(this).remove();}if(isC

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 - 如何从 '/functions' 以外的目录部署函数?

David在他的仓库中:https://github.com/davideast/react-ssr-firebase-hosting在主根目录中有带有firebase函数的文件index.js,不在/functions目录中。但是,如果我这样做并将我的index.js文件放到主根目录,如果我执行firebasedeploy--onlyfunctions它会在控制台中显示:ideployingfunctionsError:functions\index.jsdoesnotexist,can'tdeployFirebaseFunctions问:他怎么可能让它起作用?我怎样才能从/func

JavaScript for 循环替代 : repeat(n, function(i) { ... });

这是常规的for循环:for(vari=0;i它用于遍历数组,但也只是重复一些过程n次。我使用上面提到的形式,但它让我反感。标题vari=0;i非常丑陋,每次使用时都必须逐字重写。我写这个问题是因为我想出了一个替代方案:repeat(n,function(i){...});这里我们使用repeat有两个参数的函数:1.迭代次数,2.函数主体代表正在重复的过程。“代码隐藏”是这样的:functionrepeat(n,f){for(vari=0;i(我知道在流程的范围链中有两个额外的“级别”对性能的影响)顺便说一句,对于那些使用jQuery库的人来说,上述功能可以通过$.each直接实现。

javascript - Node.js https.createServer 抛出 TypeError : listener must be a function

我已经阅读了所有关于此的帖子,我知道这一定很愚蠢,但我不明白为什么下面的代码会抛出“TypeError:listenermustbeafunction”假设选项varserver=https.createServer(options,function(request,response){if(request.url==='/')request.url='/home/altronic/Opti-Cal/web/arimonitor.htm';console.log("Request:"+request.url);fs.readFile("public"+request.url,funct

javascript - Backbone : Call an extended view's overridden render() function

我有一个WorkoutExerciseRowView,它扩展了ExerciseRowView。渲染函数非常相似,除了WorkoutExerciseRowView必须向ExerciseRowView的渲染添加一些参数。如何在WorkoutExerciseRowView的渲染函数中调用ExerciseRowView的渲染函数?varWorkoutExerciseRowView=ExerciseRowView.extend({render:function(){//returnthis.constructor.render({//doesn'tworkreturnthis.render({/

javascript - 为什么 points.sort(function(a, b){return a-b});返回 -1、0 或 1?

我在这里的困难可能是我的数学文盲,但我试图对JavaScript数组中的一些数字进行排序,这是我在网上找到的解决方案。它确实有效,但我的问题是为什么?!我真的很想正确理解这段代码。网站,W3Schools说:您可以通过提供返回-1、0或1的函数来解决此问题:varpoints=[40,100,1,5,25,10];points.sort(function(a,b){returna-b});为什么只返回-1、0或1?我用Google搜索过,return几乎可以返回任何你想要的值。再次强调,如果这是一个非常愚蠢的问题,我深表歉意。 最佳答案

javascript - 如何解决TypeError : environment. teardown is not a function

我无法测试使用create-react-app创建的应用程序。所有指南都说测试默认工作,但当我尝试“yarntest”时,它需要安装“jest-cli”,安装后出现错误:TypeError:environment.teardownisnotafunction 最佳答案 您不需要自己安装jest-cli。它应该开箱即用。尝试以下操作:删除package-lock.json、yarn.lock和node_modules从package.json的依赖中移除jest然后执行npminstall或yarninstall。

javascript - 谷歌地图 - 未捕获 InvalidValueError : initialise is not a function

当我加载显示我的Googlemap的页面时,我总是在控制台中看到以下错误:UncaughtInvalidValueError:initialiseisnotafunctionjs?sensor=false&callback=initialise:94将鼠标悬停在文件名上时,这显示为源自https://maps.googleapis.com/maps/api/js?sensor=false&callback=initialiseGooglemap窗口和map显示非常好,并且具有完整的功能。奇怪的是,我在谷歌上找不到任何与此相关的搜索结果,它们似乎都是关于setLong和setLat的。如