草庐IT

滑动组件

全部标签

javascript - 遍历同一组件angular2的多个@ViewChild实例

我有一个Ionic2应用程序,它的ParentComponent调用ChildComponent@ViewChild方法来启动多个ChildComponent。其中一个ChildComponentsget在View中使用不同的参数实例化了两次,如下所示:在离线/在线设备状态更改后,我调用ChildComponent的方法来更新它返回的项目列表。@ViewChild(ChildComponent)childComponent:ChildComponent;ngOnInit():void{this.networkService.connectSubscription(()=>{this.c

javascript - React - 渲染组件的动态列表

我有一个代表自定义React组件的键列表。基于此列表,我想呈现适当的组件。我有每个组件的引用,因此我可以创建一个key->Component的映射,它允许我创建一个组件列表。但是我还没有找到一种方法来呈现这个列表。示例:input:["componentA","componentB","componentC"]output:这是我到目前为止得到的,但是我不确定如何呈现组件列表:functionrenderElements(keys){constcomponents={componentA:ComponentA,componentB:ComponentB,componentC:Compo

javascript - 除非调整页面大小,否则滑动 slider 不起作用

我正在尝试添加Swiper插件到我的页面之一。我想要实现的是在此处集成getthecarousalsliderhttp://idangero.us/swiper/demos/05-slides-per-view.htmlHTMLSlide1Slide2Slide3Slide4Slide5Slide6Slide7Slide8Slide9Slide10JSvarswiper=newSwiper('.swiper-container',{pagination:'.swiper-pagination',slidesPerView:3,paginationClickable:true,space

javascript - 第一次加载组件时 Angular 4 ngOnInit 不工作

我在Angular4中有一个组件和一个用于更改路由的模板这个组件被调用但不加载任何没有服务器调用的东西。如果我将ngOnInit()方法内容放入构造函数中,它就可以正常工作。似乎没有调用ngOnInit。自从过去2天以来,任何人都可以帮助我处理这个问题。这是我的路由配置。consttestRouting:ModuleWithProviders=RouterModule.forChild([{path:'createtest/:id',component:TestComponent,resolve:{test:TestResolver}},{path:'createtest',compo

javascript - Vuex Mutation 正在运行,但组件在 vue 开发工具中手动提交之前不会更新

我有一个vue组件,我无法从通过服务调用填充的计算属性进行更新。Feed.vueStatsfor{{feed.name}}loading{{feedID}}exportdefault{data:()=>{return{feedID:false}},computed:{feed(){returnthis.$store.state.feed.currentFeed},loading(){returnthis.$store.state.feed.status.loading;}},created:function(){this.feedID=this.$route.params.id;var

javascript - Vue-动态导入vue组件

我有很多组件,我想按需导入。我有一个下拉列表,其中实际包含组件列表,即要加载的内容。我试过这个例子在脚本中componentLoader(){return()=>import('@/components/testDynamic')}testDynamic是一个组件名称(现在我正在尝试使用静态组件)。出现这个错误GEThttp://localhost:8080/0.jsnet::ERR_ABORTED404[Vuewarn]:Failedtoresolveasynccomponent:function(){return__webpack_require__.e/*import()*/(0

javascript - 具有动态图像源的可重用 Gatsby-Image 组件

我正在考虑在我的下一个项目中使用Gatsby-Image,并且已经尝试了一些。我让它在我的测试项目上工作,但后来我想出了一个用例,我想像使用常规一样使用Gatsby的标签。标签。如何使Gatsby组件可重用?importReactfrom"react"import{StaticQuery,graphql}from"gatsby"importImgfrom"gatsby-image"functionrenderImage({file}){console.log({file})return}//StatelessImagecomponentwhichIguesswill//receivet

javascript - 使用 Webpack 4 构建 React 组件库

我目前正在构建一个React组件库并将其与Webpack4捆绑在一起。从构建库的包到将其发布到npm注册表,一切都运行良好。但是,我无法在其他React应用程序中导入它的任何组件并在运行时收到此错误消息:Elementtypeisinvalid:expectedastring(forbuilt-incomponents)oraclass/function(forcompositecomponents)butgot:undefined.Youlikelyforgottoexportyourcomponentfromthefileit'sdefinedin,oryoumighthavemi

javascript - knockoutjs 中的滑动 Action 绑定(bind)

我在我的应用程序中使用knockout作为主要框架,它必须支持平板电脑和移动设备。由于该框架是建立在绑定(bind)处理程序上的,我想知道如何自定义绑定(bind)到操作(如滑动和其他设备特定的操作),或者可能有类似的事情完成? 最佳答案 可能为时已晚,但这里有一个将触摸绑定(bind)添加到knockoutjs的库:https://github.com/yaroslavya/knockouch 关于javascript-knockoutjs中的滑动Action绑定(bind),我们在S

javascript - 使用 Browserify 设置 Karma 以测试 React (ES6) 组件

我在使用Karma+Browserify为某些React组件设置测试配置时遇到了问题。提到代码是用ES6编写的,我已经升级到最新的Babel版本(6+),我认为这是此配置中万恶之源。由于Babel现在已拆分并具有这种基于插件的方法(预设),我不确定我应该如何在karma.conf文件中指定它。我当前的配置如下所示:module.exports=function(config){config.set({basePath:'',browsers:['PhantomJS'],frameworks:['browserify','jasmine'],files:['app/js/**/*','a