小编jps*_*kgc的帖子

如何通过semantic-ui-react实现react分页

我正在pagination通过 实现功能semantic-ui-react
我可以实现分页组件本身,但无法实现onPageChange设置activePage和控制显示的页面数。

我使用 React 来实现客户端功能。
我还使用semantic-ui-react作为css框架。

数组的所有内容现在都列在单个页面上。
但我想实现分页并限制在单页上显示5个内容。
我以某种方式理解我需要使用onPageChange,但不知道如何实现该目标。

import React from 'react';
import {Link} from 'react-router-dom';
import {Grid, Segment, Container, Header, Pagination} from 'semantic-ui-react';
import axios from 'axios';
import {Article} from '../articleData';

interface ArticleState {
  articles: Article[];
}

class List extends React.Component<{}, ArticleState> {
  constructor(props: {}) {
    super(props);
    this.state = {
      articles: [],
    };
    this.serverRequest = this.serverRequest.bind(this);
    this.btnClick = this.btnClick.bind(this);
  }

  serverRequest() {
    axios
      .get('/api/articles')
      .then(response => { …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs semantic-ui

7
推荐指数
1
解决办法
8441
查看次数

create-react-app 的内容没有推送到 github 中

我将 go & react 代码推送到了 github。

Go 代码已成功提交,但 React 代码未成功提交。

React 内容是由create-react-app.

article
? api
?  ? main.go
? client
   ? React content made by create-react-app
Run Code Online (Sandbox Code Playgroud)

github的图片

这是目标github

https://github.com/jpskgc/article

我尝试了以下命令,但没有解决。

error: the following file has staged content different from both the
file and the HEAD:
    client
(use -f to force removal)
$ git rm --cached client -f
rm 'client'

Run Code Online (Sandbox Code Playgroud)

我也尝试了以下命令,但问题没有解决

$ rm -rf client/.git
Run Code Online (Sandbox Code Playgroud)

client 文件夹的内容将在 github 中提交。但实际上没有承诺。

git github reactjs

2
推荐指数
1
解决办法
3244
查看次数

ValidationError:选项对象无效。CSS Loader 已使用与 API 架构不匹配的选项对象进行初始化

苏梅里

我通过yarncreate nuxt-app以SPA模式创建了Nuxt.js项目。
但是,安装Storybook后,yarn dev重新出现错误并且无法启动演示页面。

ERROR  Failed to compile with 1 errors                                                       friendly-errors 17:38:56

ERROR  in ./layouts/error.vue?vue&type=style&index=0&id=d5ea9138&scoped=true&lang=css&       friendly-errors 17:38:56

Module build failed (from ./node_modules/css-loader/dist/cjs.js):                             friendly-errors 17:38:56
ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
 - options.modules has an unknown property 'compileType'. These properties are valid:
   object { auto?, mode?, exportGlobals?, localIdentName?, localIdentRegExp?, context?, hashPrefix?, getLocalIdent? }
    at validate (/home/jpskgc/ghq/github.com/jpskgc/vue-nuxt-vuetify-sass-storybook/node_modules/css-loader/node_modules/schema-utils/dist/validate.js:98:11)
    at Object.loader (/home/jpskgc/ghq/github.com/jpskgc/vue-nuxt-vuetify-sass-storybook/node_modules/css-loader/dist/index.js:36:28)
                                                                                              friendly-errors 17:38:56 …
Run Code Online (Sandbox Code Playgroud)

javascript webpack vue.js nuxt.js

1
推荐指数
1
解决办法
7258
查看次数

docker build 因“COPY failed: no such file or directory”错误而失败

我正在设置 travis-ci 以在它们提交到 github 时构建和推送 docker 图像。
但是即使 api 和 nginx 图像成功,客户端 docker 图像也不会构建并推送到 docker hub。

源代码在这里:https :
//github.com/jpskgc/article

  • 客户:反应
  • api:golang
  • ci:travis-ci

这是 .travis.yml

language: generic
sudo: required
services:
  - docker

before_install:
  - docker build -t jpskgc/react-test -f ./client/Dockerfile.dev ./client

script:
  - docker run -e CI=true jpskgc/react-test npm test

after_success:
  - docker build -t jpskgc/multi-client ./client
  - docker build -t jpskgc/multi-nginx ./nginx
  - docker build -t jpskgc/multi-api ./api
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin
  - docker …
Run Code Online (Sandbox Code Playgroud)

continuous-integration travis-ci docker reactjs dockerfile

0
推荐指数
1
解决办法
3794
查看次数