草庐IT

FILTER_VALIDATE_FLOAT

全部标签

javascript - Vue.js : Vuetify server side Datatable search filter not working

我正在为我的数据表使用vuetify。除搜索过滤器外,分页和排序都在工作。来自搜索过滤器的响应数据是正确的,但问题是它没有呈现对我的模板的响应。在vuetify文档那里只有分页和排序。我正在尝试通过服务器端实现搜索功能。我的用户.vueexportdefault{data(){return{max25chars:(v)=>v.length{constself=this;self.items=data.items;self.totalItems=data.total;})},deep:true}},mounted(){this.getDataFromApi().then(data=>{t

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

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

JavaScript filter() 方法混淆

作为LearnJavaScriptProperly的一部分,我正在研究JavaScript:权威指南,我在推理第7章数组方法部分的filter()方法时遇到了麻烦。这是提供的示例:Thefilter()methodreturnsanarraycontainingasubsetoftheelementsofthearrayonwhichitisinvoked.Thefunctionyoupasstoitshouldbepredicate:afunctionthatreturnstrueorfalse.ThepredicateisinvokedjustasforforEach()andma

javascript - Array.filter 无法正常工作

我有一个数组,我想从中删除一条记录我已经使用了Array.filter()但它返回的是相同的数组。我的代码:varurl=window.location.pathname,orderId=url.split('/').slice(-2)[0];varCart=JSON.parse(localStorage.getItem('Cart'));newCart=Cart.filter(function(item){if(parseInt(item.orderId)==parseInt(orderId)){return{};}else{returnitem;}});localStorage.s

javascript - knockout validation : how to validate the fields on button click, 不在输入更改时

我正在使用以下knockoutvalidation插件:https://github.com/Knockout-Contrib/Knockout-Validation我想在单击“提交”按钮时验证我的字段,而不是每次更改输入值时。我该怎么做?Javascript:ko.validation.init({insertMessages:false,messagesOnModified:false,decorateElement:true,errorElementClass:'wrong-field'},true);varviewModel={firstName:ko.observable()

javascript - Parse Float 有舍入限制吗?我怎样才能解决这个问题?

我建立了一个将紧凑数据字符串解析为JSON的系统。我正在使用19位数字来存储ID。不幸的是,任何大于17位的数字,parseFloat()都会舍入最后几位数字。这会破坏整个数据字符串。我可以解决这个问题吗?例如8246295522085275215变成了8246295522085276000。这是为什么?http://jsfiddle.net/RobertWHurst/mhZ7Q/ 最佳答案 JavaScript只有一种数字类型,即IEEE754doublefloating-point.这意味着,您的精度最多为52位,比小数点后15

JavaScript 1.6 Array.map() 和 Array.filter() 不使用内置函数作为参数

这很好用:["655971","2343","343"].map(function(x){returnparseInt(x)})//[655971,2343,343]但这不是:["655971","2343","343"].map(parseInt)//[655971,NaN,NaN]Array.filter()也是如此我在这里错过了什么? 最佳答案 这是因为map向回调函数传递的参数不仅仅是数组项。你得到:callback(item,index,array)通常你的函数会忽略它不需要的参数。但是parseInt接受一个可选的第二个

javascript - 输入数字验证 - 限制仅输入数字或数字,int 和 float 两者

如何限制输入字段只输入数字/数字int和float两者。有时我们需要为金额等字段同时允许整数和浮点值,因此在这种情况下需要进行验证。没有可用的解决方案,但它们的代码量很大。所以需要一个简短但有效的代码。Inputboxthatacceptsonlyvalidintandfloatvalues. 最佳答案 Noneedforthelongcodefornumberinputrestrictionjusttrythiscode.Italsoacceptsvalidint&floatbothvalues.Javascript方法onloa

javascript - 只允许输入 float

在使用jquery库进行只允许float的输入时,我感到很痛苦。我的代码无法阻止字符“。”当它成为第一个输入时,任何人都可以指导我解决这个问题吗?$('.filterme').keypress(function(eve){if((eve.which!=46||$(this).val().indexOf('.')!=-1)&&(eve.which57)||($(this).val().indexOf('.')==0)){eve.preventDefault();}});​ 最佳答案 我用这个-适用于键盘输入或复制和粘贴$('input

javascript - 使用 ngx-filter-pipe angular 过滤多个值

我正在使用Angular为4的ngx-filter-pipe,但我遇到了这个问题。我设法用一个值过滤,现在我试图用多个值过滤数据:这是我得到的这是我的组件:@Component({selector:'deudas-list',templateUrl:'../views/deudas-list.html',providers:[DeudaService]})exportclassDeudasListComponent{publictitulo:string;publicdeudas:Deuda[];publicuserFilter:any={mes:''};constructor(pri