草庐IT

my_parent

全部标签

javascript - ES6 继承 : uses `super` to access the properties of the parent class

Javascript的super关键字,当我在Chrome、Babel、TypeScript上运行代码时,我得到了不同的结果。我的问题是哪个结果是正确的?规范的哪一部分定义了这种行为?以下代码:classPoint{getX(){console.log(this.x);//C}}classColorPointextendsPoint{constructor(){super();this.x=2;super.x=3;console.log(this.x)//Aconsole.log(super.x)//B}m(){this.getX()}}constcp=newColorPoint();

javascript - NodeJS - 如何让生成的 child 与 parent 沟通?

我正在尝试这个:varchild=spawn('node',args,{cwd:parentDir,stdio:'ipc'});(args是一个参数数组)但它给出了以下错误:TypeError:Incorrectvalueofstdiooption:ipc这确实有效,所以问题似乎确实出在stdioipc参数上:varchild=spawn('node',args,{cwd:parentDir});这也有效:varchild=spawn('node',args,{cwd:parentDir,stdio:'pipe'});我读到这个:http://nodejs.org/api/child_

javascript - Angular 2 : Validate child component form fields from the parent component

问题陈述:父组件有标签和一些里面的标签,子组件也有一些标签,父组件有一个我们正在验证提交表单时的表单字段。如何验证子组件来自父组件的字段submit表格?要求:如果父组件的表单包含带有input的子组件模板中的组件,然后是这些input如果从父组件提交,组件应该在点击时验证。调查结果:SO中有很多帖子有相同的问题陈述,但没有找到任何合适的解决方案。以下所有帖子都验证了整个表单,但我的要求是验证子组件中的每个字段。Angular2validationtogetherwiththechildcomponentAllowtemplate-drivenforminputsacrossacomp

javascript - D3 : use nest function to turn flat data with parent key into a hierarchy

我确信有一种非常简单优雅的方法可以做到这一点,但我不太明白。我有一些看起来像这样的输入数据:[{id:1,name:"Peter"},{id:2,name:"Paul",manager:1},{id:3,name:"Mary",manager:1},{id:4,name:"John",manager:2},{id:5,name:"Jane",manager:2}]如果可能,我想使用d3.js嵌套运算符来获取要在层次结构布局中使用的结构。像这样:[{name:"Peter",children:[{name:"Paul",children:[{name:"John"},{name:"Jan

javascript - .parents() 在 Angular 中?

有什么方法可以模拟jQuery的.parents()Angular中的方法,而不必实际包含jQuery?最终目标是获取DOM元素的所有父元素。编辑:为什么我需要这个?我正在创建一个指令(一个类似下拉的小部件)。下拉列表应收听整个对于点击并在小部件区域外进行点击时自行关闭(如果它打开)。现在,我知道如何创建一个简单的指令来监听鼠标事件,如下所示:app.directive('mouseTrap',function(){returnfunction(scope,elem){elem.bind('click',function(event){scope.$broadcast('click',

Javascript 继承 : Parent's array variable retains value

我在这里尝试在JavaScript中使用继承,我发现Parent类中的数组值被Child类继承时出现问题。下面的代码是正常的继承:varParent=function(){this.list=[];};varChild=function(){};Child.prototype=newParent;Child.prototype.constructor=Child;varobj1=newChild;obj1.list.push("hello");console.log(obj1.list);//prints["hello"];当我将新的Child对象(继承包含名为list的数组变量的Pa

javascript - jquery如何获取 parent 的姓名

我正在搜索提供父级名称的元素。这:$('.Item').click(function(){vara=$(this).parent();alert(a[0].tagName);});只是说“DIV”,但我需要一个元素的真实名称。谢谢 最佳答案 尝试以下(提醒标签名称,然后是真实姓名):我使用了$(a[0]).attr('name');例如$('.Item').click(function(){vara=$(this).parent();alert(a[0].nodeName.toLowerCase());//TagNamealert(

javascript - Angular : Why is my event handled twice?

我有三个Controller:main、product、customer。ControllerA是我的“主页”的一部分。ControllerB和C取决于位置。Controller主要:varMainController=function($scope,$location,$rootScope,ToolbarService){$scope.addClicked=function(){ToolbarService.onAddButtonClick();};};app.controller({MainController:MainController});产品:varProductContr

javascript - 剧情 js : how to run my javascript ONLY after plot image is loaded

当通过JavascriptAPI(plotly.js,而不是plotly-nodejs)使用任何类型的plotly图表时,我如何才能在图表加载后运行一些javascript?我正在寻找plotlyjavascriptAPI中的机制,例如,在使用GoogleMapsAPI时,它与“addListenerOnce”结合“tilesloaded”或“ready”执行相同的操作。例如,假设我想在呈现https://plot.ly/~PlotBot/685处显示的示例后立即简单地显示一个警报,其html和js代码可以在https://plot.ly/~PlotBot/685.js查看.这样做的原

javascript - 为什么这个被屏蔽的 JS 代码在 GET 参数 : '*alert(13)*' executed on my page?

我们对我们的网站进行了白帽扫描,他们返回的漏洞之一是我们的URL附加了whscheck'*alert(13)*'a/。当我们运行完整的URL(https://oursite.com/phorders3/index.php/whscheck'*alert(13)*'a/)时,网站会加载并发出带有值的警报13流行音乐。谁能解释这是如何工作的?星号和a/到底在做什么? 最佳答案 您页面中的代码在Javascript的字符串文字中使用URL中的值,而没有正确转义该值。这意味着任何人都可以将Javascript放在URL中,它就会在页面中执行