草庐IT

set_index

全部标签

javascript - typescript TS7015 : Element implicitly has an 'any' type because index expression is not of type 'number'

我在Angular2应用程序中遇到此编译错误:TS7015:Elementimplicitlyhasan'any'typebecauseindexexpressionisnotoftype'number'.导致它的代码是:getApplicationCount(state:string){returnthis.applicationsByState[state]?this.applicationsByState[state].length:0;}但这不会导致此错误:getApplicationCount(state:string){returnthis.applicationsBySt

javascript - 在 ng-repeat 中使用 'track by $index' 时,ng-animate 动画错误的项目

我正在尝试创建用户可以选择不同类型的block并将它们堆叠在一起以创建独特模板的应用程序。因为我希望用户能够多次将同一block添加到模板中,所以我必须使用“按$index跟踪”来完成此操作:但是,当我尝试使用ng-animate添加动画时,用于移除block的动画是在模板中的最后一个block而不是移除block上动画。我把代码放在jsfiddle里http://jsfiddle.net/FC9c7/6/.尝试通过选择布局1、2或3添加新block。当您单击“删除block”时,您将看到问题。 最佳答案 这就是我认为正在发生的事情

javascript - react-redux : What is the difference between state. setIn() 和 state.set()?

我在一些react-redux代码中看到了setIn()和set()的使用:state.setIn(...);state.set(...);我在这里找到了一些文档https://facebook.github.io/immutable-js/但不幸的是,该方法没有详细记录。我还发现了一些其他问题:UsingReact'simmutablehelperwithImmutable.js但这些并没有回答我的问题。我明白,它必须做一些不可变的事情吗?但是这里不可变的东西是什么?set()和setIn()有什么区别?为什么我们需要不可变? 最佳答案

javascript - 错误 TS7017 : Index signature of object type implicitly has an 'any' type in form validation angular 2

我在给出的Angular2中进行响应式(Reactive)验证时遇到编译错误errorTS7017:Indexsignatureofobjecttypeimplicitlyhasan'any'type为了this.comErrors[field]='';constmessages=this.validationMessages[field];this.comErrors[field]+=messages[key]+'';它正在按应有的方式运行,但是当我尝试运行npmrunbuild.prod时,出现错误并且无法构建我的项目这是我的代码:onValueChanged(data?:any)

javascript - 使用 ng-repeat 和过滤器时数组中对象的 $index

我对Angular还很陌生,并且已经能够绕过一些地方。但我似乎无法找到这种情况的答案......我有一组对象,我正在从firebase中拉下来。我正在对对象使用ng-repeat,然后相应地显示数据。我试图将索引作为路由参数传递给“编辑”Controller。在这种情况下,我想像预期的那样提取对象数据。但是,当我过滤ng-repeat时,我得到了过滤内容的索引。我在寻找真实索引时哪里出错了?.config(['$routeProvider','$locationProvider',function($routeProvider,$locationProvider){$routeProv

javascript - Angular 6 : How to set response type as text while making http call

我试图向springrestAPI发出http请求。API返回一个字符串值(“成功”或“失败”)...但我不知道如何在调用时将响应类型设置为字符串值API..它的抛出错误,因为后端返回代码200,正文是:[objectObject]我的Angular代码如下,订单.服务.tsimport{Injectable}from'@angular/core';import{HttpClient,HttpHeaders}from'@angular/common/http';import{ProductSearch}from'../_models/product-search';import{Pro

javascript - 未捕获的类型错误 : Cannot set property playerNo of# which has only a getter on line 4

我正在从使用旧的(函数和原型(prototype))hackyJavaScript类转向使用新的ES6类。我可能正在做一些愚蠢的事情,但我不确定为什么不允许我这样做:classPlayer{constructor(playerNo){this.playerNo=playerNo;}getplayerNo(){returnthis.playerNo;}setcards(playersCards){this.cards=playersCards;}getcards(){returnthis.cards;}}varsteve=newPlayer(1);它给我错误:UncaughtTypeEr

【Qt+FFmpeg】FFmpeg解码固定摄像头分辨率——推流 av_dict_set 参数设置

你是否出现过ffmpeg编解码摄像头在自己电脑上是正常的,但是在别的机子上却不能编码成功,或者即使成功,也只画面显示了一部分,和自己电脑上测试的不一样;根据我的测试,这应该是摄像头分辨率不匹配造成的,比如说你电脑的摄像头分辨率是1080*720,在比你分辨率高的摄像头如1920*1080上运行时,画面像是被放大,只显示了一角;如果你在比你摄像头分辨率低的电脑上运行,如640*480,编码完就不能正常生成h264文件;解决方法:我们需要用到AVDictionary字典,并运用av_dict_set进行设置摄像头分辨率,每次打开只调用640*480档位的;AVDictionary*options=

javascript - Firebase 警告 : Using an unspecified index

对于我在JavaScript查询中使用的每个orderByChild,我都会从Firebase收到这条警告消息:FIREBASEWARNING:Usinganunspecifiedindex.Consideradding".indexOn":""at/tablestoyoursecurityrulesforbetterperformance到目前为止,我的查询运行得相当快,所以我认为没有必要包含indexOn。只是想知道负面影响是什么?此外,我该如何实际禁用警告,因为它们在调试时非常烦人。 最佳答案 如果您处于开发阶段,您将感觉不到

php - index.php 作为 laravel 网站 url 中的参数

我发现任何laravel网站都可以使用index.php作为参数访问。这是一个大问题,url参数中的index.php破坏了所有图像。看一个真实的例子来理解我的意思:http://www.cyprusalive.com/main-thing/sightseeinghttp://www.cyprusalive.com/index.php/main-thing/sightseeingGooglebot读取了一些带有index.php作为url参数的url。当有人使用index.php从谷歌搜索访问该网站时,这会破坏所有图像。此外,这是一种糟糕的SEO做法,因为会产生重复的内容。解决该问题的