草庐IT

has_content_type

全部标签

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 - 尝试使用 gh-pages 部署我的 React 应用程序但收到此错误消息 : The "file" argument must be of type string. Received type undefined

我试图用gh-pages部署我的React应用程序,但我遇到了这个错误:"file"参数必须是字符串类型。接收类型未定义。起初,我以为这是我的代码,所以我制作了另一个没有修改的create-react-app,尝试使用npmrundeploy命令进行部署,但再次收到此错误消息。我的package.json(我添加了我的homepage链接、predeploy和deploy脚本,以及gh-页面依赖):"name":"test-deploy","version":"0.1.0","private":true,"homepage":"https://vnsteven.github.io/te

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 - 错误 TS2315 : Type 'ElementRef' is not generic material angular

在项目中添加AngularMaterial时出错ERRORinnode_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(136,20):errorTS2315:Type'ElementRef'isnotgeneric.node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(154,104):errorTS2315:Type'ElementRef'isnotgeneric我正在尝试安装MaterialDesign,但

javascript - Swagger 'GET' 请求总是以 text/html 形式返回 Accept type on response 而不是 application/json

我有一个使用SwaggerUI的swagger标签文档,它总是返回text/html但它应该返回application/json。POST请求和所有其他类型都返回application/json但这个特定的GET请求不会。服务端点代码正确。如果我将请求更改为POST,它会作为application/json返回。所以它只是在swagger中键入GET,它不会返回正确的类型。有没有想过如何更正UI中的调用以使用application/json?这是最近从swagger站点下载的swagger版本2.1.4。"/bankName":{"get":{"summary":"BankNameSe

javascript - 是否可以通过鼠标单击 <input type=text> 元素来 dispatchEvent()?

基本上,我尝试使用以下代码将自定义的鼠标单击事件分派(dispatch)到文本输入元素(参见jsFiddle):functionsimulateClick(id){varclickEvent=document.createEvent("MouseEvents");clickEvent.initMouseEvent("click",true,true,window,1,0,0,0,0,false,false,false,false,0,null);varelement=document.getElementById(id);element.dispatchEvent(clickEvent

javascript - jQuery 颜色框 : how do I prevent the loading indicator small box from appearing before the main colorbox content does?

我正在使用jQuerycolorbox加载登录表单(通过ajax)。但是,这个小方框会显示几秒钟,然后会淡入我要加载的实际内容中。所以在观察了几个colorboxexamples之后在网站上,我有点确定这个小盒子应该是一个预装盒子。有什么办法可以让这个框完全不显示吗?我试过一些愚蠢的事情,比如调整CSS和为所有加载项设置display:none,但它不起作用。我想避免任何CSShack并通过修改javascript来解决这个问题。理想情况下,加载框永远不会显示的某种方式,因为我不会将colorbox用于任何需要很长时间才能加载。使用我修改过的colorboxjavascript和CSS

javascript - JS/J查询 : how to check whether dropdown has selected values?

我已经用谷歌搜索并尝试了很多方法来做到这一点,但到目前为止没有一个对我有用。我要找的东西很简单:我想知道下拉列表是否有选定的值。问题在于selectedIndex、:selected、val()等确实会针对以下情况返回结果:123234很明显,浏览器会显示这个下拉菜单,其中123选项被选中,但它会被选中只是因为没有其他选项,实际上这个下拉菜单没有选中的值,因为没有“selected”属性。所以基本上我试图找到如何区分上面的下拉菜单123234 最佳答案 varhasValue=($('select>[selected]').leng

javascript - Chrome 扩展 : Communication between content script and background. html

我是Chrome扩展的新手。我试图在内容脚本和background.html页面之间进行通信。background.html向内容脚本发送请求“hello”,内容脚本应以“hellobackground”警报响应.但这并没有发生。我的background.html代码是:functiontestRequest(){chrome.tabs.getSelected(null,function(tab){chrome.tabs.sendRequest(tab.id,{greeting:"hello"});});}content.js代码:chrome.extension.onMessage.

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