草庐IT

dynamic-properties

全部标签

javascript - Webpack:TypeError:无法读取未定义的属性 'properties'

这是有问题的分支和repo:https://github.com/Futuratum/moon.holdings/tree/dev/Users/leongaban/projects/Futuratum/moon.holdings/node_modules/webpack-cli/bin/config-yargs.js:89describe:optionsSchema.definitions.output.properties.path.description,不确定为什么会出现此错误,但我已从Webpack3升级到4。网页包/*eslint-disableno-console*/imp

javascript - require.js 未捕获类型错误 : cannot read property '__module_path__; of undefined

所以我刚刚开始尝试掌握require.js,但它似乎不起作用。当我使用标签将其包含在我的html中时:在chrome中加载页面时出现以下错误UncaughtTypeError:Cannotreadproperty'__MODULE_PATH__'ofundefined->require.js:538在firefox中我得到一个稍微不同的错误:TypeError:parentisundefined->require.js:538不知道我怎么会导致这个问题,因为它是require.js的全新安装,我的main.js中还没有代码。提前致谢 最佳答案

javascript - 传单绘制插件 : How to hide/show drawing tools by Layer Type dynamically

我在项目中使用绘图插件,我想知道如何按图层类型隐藏/显示绘图工具?例如,假设我有2个图层,其中一个类型是多边形,另一个是线。如果用户选择多边形层,我想隐藏画线工具。之后,如果用户选择线层,我想隐藏多边形绘图工具。我看过here但是这个例子使工具成为静态的,我想动态地改变。我该怎么做?我们将不胜感激。 最佳答案 我自己解决了。我在map初始化时添加了这个绘制控件。drawControl=newL.Control.Draw({draw:{position:'topleft',polygon:false,polyline:false,re

javascript - react : dynamically add input fields to form

我正在为表单使用formsy-react,我想在触发事件时呈现更多选项,代码如下所示:classMultipleChoiceextendsComponent{constructor(props){super(props);}render(){return();}}我有一个按钮和onClick事件,我想触发一个将另一个附加到divid“dynamicInput”的函数,这可能吗? 最佳答案 是的,我们可以更新组件的底层数据(即state或props)。React如此出色的原因之一是它允许我们专注于我们的数据而不是DOM。假设我们有一个

javascript - 错误 :Property 'select' does not exist on type HTMLElement

functioncopy(){varUrl=document.getElementById("Id");Url.select();//errordocument.execCommand("Copy");//browsercopy}如上。我正在尝试制作一个在浏览器中复制文本的功能。但是出现了标题错误在typescript中。我认为select()是有效的(link),因为我在演示中使用它时可以正确复制。我的ts版本是2.8.1 最佳答案 您需要添加一个typeassertion:varUrl=document.getElementBy

javascript - 未捕获的类型错误 : cannot read property 'innerHTML' of null

谁能解释一下这个错误是什么?UncaughtTypeError:cannotreadproperty'innerHTML'ofnull这是导致问题的行:varidPost=document.getElementById("status").innerHTML; 最佳答案 varidPost=document.getElementById("status").innerHTML;您的网页中不存在“状态”元素。因此document.getElementById("status")返回null。虽然您不能使用NULL的innerHTML属

javascript - 未捕获的类型错误 : Cannot read property 'focus' of undefined

此问题在我的页面加载时发生。使用以下脚本-jquery.simplemodal-1.4.3.js-jqueryv1.7.1下面是一个小代码快照,是发生此错误的simplemodal内的代码。focus:function(pos){vars=this,p=pos&&$.inArray(pos,['first','last'])!==-1?pos:'first';//focusondialogorthefirstvisible/enabledinputelementvarinput=$(':input:enabled:visible:'+p,s.d.wrap);setTimeout(fun

javascript - Typescript "Cannot assign to property, because it is a constant or read-only"即使属性未标记为只读

我有以下代码typeSetupProps={defaults:string;}exportclassSetupextendsReact.Component{constructor(props:any){super(props);this.props.defaults="Whatever";}尝试运行此代码时,TS编译器返回以下错误:Cannotassignto'defaults'becauseitisaconstantoraread-onlyproperty.deafualts是只读属性,但显然没有这样标记。 最佳答案 您正在扩展R

javascript - 在 karma 中使用 angular.mock.inject 给出 "TypeError: Cannot read property ' $injector' of null"

我正在尝试使用Karma对AngularJS进行一些基本的单元测试。我编写的所有测试在语法上似乎都是正确的。但是我在最基本的步骤中遇到了问题,即代码的beforeEach部分。当我尝试运行测试时,出现以下问题TypeError:Cannotreadproperty'$injector'ofnullatObject.workFn(http://localhost:9876/absolute/Users/vesriram/Documents/AngularJS%20project/vendor/js/angular-mocks.js:1698:15)atObject.(http://loc

javascript - JSDoc Toolkit - 如何在同一行指定@param 和@property

有没有一种方法可以避免为@property和@param键入两行单独的内容,如示例所示,在构造函数中参数和属性的名称相同。/***Classforrepresentingapointin2Dspace.*@property{number}xThexcoordinateofthispoint.*@property{number}yTheycoordinateofthispoint.*@constructor*@param{number}xThexcoordinateofthispoint.*@param{number}yTheycoordinateofthispoint.*@return