草庐IT

next-match

全部标签

javascript - 类型 'ReactType' 不是通用的 (material-ui@next)

我安装了Materialui@next,但我在Node模块中遇到了这个错误。[at-loader]中的错误./node_modules/material-ui/Avatar/Avatar.d.ts:8:1511:31:52web.1|TS2315:类型“ReactType”不是通用的。11:31:52web.1|[at-loader]中的错误./node_modules/material-ui/Button/Button.d.ts:7:1511:31:52web.1|TS2315:类型“ReactType”不是通用的。11:31:52web.1|[at-loader]中的错误./nod

javascript - 行为主题 : next is not a function

我正在尝试在同级组件之间共享数据并通过共享服务执行此操作。当第一个组件加载时,它从我的API中检索服务器列表,并用所有检索到的服务器填充一个选择框。现在我想在用户选择新服务器时通知我的其他组件,以便我可以显示它的详细信息。这是我的服务:@Injectable()exportclassDashboardService{servers:Server[]=[];selectedServer=newBehaviorSubject(null);setServers(servers:Server[]){this.servers=servers;}}带有选择框的组件:@Component({sele

javascript - 无限滚动和 will_paginate 多次附加项目的 'next page'

我正在关注thisrailscast尝试在我的Rails应用程序上实现无限滚动页面。当用户向下滚动到页面底部时,将附加一组新的项目并且页面会扩展,但是它会多次附加到页面,即使数组中的所有项目都已加载,事件也会在向下滚动时再次触发,多次再次附加同一组项目。我想要的是在每次用户滚动到底部时附加项目的“下一页”,并在用户再次滚动到底部时附加后续的下一页。这是这个函数的jQuery:jQuery->if$('.pagination').length$(window).scroll->url=$('.pagination.next_page').attr('href')ifurl&&$(wind

javascript - AngularJS 和 i18next

我看过一些Angular的i18n插件,但我不想重新发明轮子。i18next是一个很好的库,所以我打算使用它。我创建了一个仅调用i18n库的指令i18n:define(['app','jquery','i18n'],function(app,$,i18n){'usestrict';app.directive('i18n',function(){returnfunction($scope,elm,attrs){attrs.$observe('i18n',function(value){if($.fn.i18n){//forsomereason,itisn'tloadedquicklyen

javascript - 使用 .match 和 .search 的区别

我为coderbyte使用了以下代码:functionVowelCount(str){//codegoesherereturnstr.match(/[aeiou]/gi).length;}//keepthisfunctioncallhere//toseehowtoenterargumentsinJavaScriptscrolldownprint(VowelCount(readline()));我理解大部分代码,除了以下部分:正斜杠和方括号的作用是什么?gi有什么作用?search()和match()有什么区别?我应该在什么情况下使用什么? 最佳答案

javascript - 在 ES6 中,第一次调用迭代器的 `next` 方法时参数会发生什么变化?

如果你有一个生成器,比如,function*f(){//Beforestuff.leta=yield1;letb=yield2;return[a,b];}然后运行varg=f();//thisquestionisoverthisvalue.g.next(123);//returns:{value:1,done:false}g.next(456);//returns:{value:2,done:false}g.next();//returns:{value:[456,undefined],done:true}第一次调用.next()设置a为123,第二次调用设置b到456,但是在最后一次

javascript - 将 react redux 与 next.js 结合使用

我尝试将Redux与next.jsstarter结合使用项目,我在项目上安装了next-redux-wrapper但我不确定这个项目的根文件在哪里。我尝试按照next-redux-wrapper上显示的教程进行操作但没有成功。没有任何变化。请帮助我如何将Redux添加到项目中。问候。 最佳答案 Next.js使用App组件来初始化页面。您可以覆盖它并控制页面初始化。虽然这个演示是针对next.js的,但它应该适用于nextjs-starter。安装next-redux-wrapper:npminstall--savenext-red

JavaScript(正则表达式): excluding matches from output

我有这个文本:nisinontext600elit其中600是动态添加的。我怎样才能得到它?varstr=('nisinontext600elit').match(/text\d+/);alert(str);这会提醒text600,我如何才能只提醒600而无需额外替换单词text(如果可能的话)?感谢任何帮助,谢谢! 最佳答案 varstr=('nisinontext600elit').match(/text(\d+)/);alert(str[1]); 关于JavaScript(正则表达

javascript - 不能将 String.prototype.match 用作 Array.some 的函数吗?

这行不通:vars='^foo';console.log(['boot','foot'].some(s.match));UncaughtTypeError:String.prototype.matchcalledonnullorundefined但是这样做:vars='^foo';console.log(['boot','foot'].some(function(i){returni.match(s)}));这是为什么?我以某种方式想象String.prototype.match函数太“原始”之类的,但究竟是为什么呢?因为我没有使用ES2015,所以第二个版本看起来很冗长。有替代方案吗

javascript - 使用 i18next 的异步语言选择器

我正在使用http://jamuhl.github.com/i18next本地化静态网站。我的初始化脚本是:jQuery(function($){varsetLng=$.url().param('setLng');if(setLng){language_complete=setLng.split("-");}else{language_complete=navigator.language.split("-");}language=(language_complete[0]);console.log("Ispeak(root):%s",language);i18n.init({lng: