Giter Site home page Giter Site logo

dva-example-user-dashboard's People

Contributors

sorrycc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dva-example-user-dashboard's Issues

roadhog build的问题

这个项目拉下来后,没有改动,运行 npm install,再运行npm run build,把dist文件夹拷贝到apache服务下后,浏览这个index.html,发现页面是空白的。
npm start 是可以看到demo效果的

example的依赖是太老跟新的API相冲突

package.json 的依赖:
"dva": "^1.4.0-beta.1",
"roadhog": "^0.6.0"

这两个依赖过老,尤其dva版本使用的API和新版很多不一致的地方,更新dva 2.1.0后项目没法跑起来,在dva使用上已经没有参考价值了,roadhog可以根据文档升级解决,请及时更新,谢谢。

build之后,在dist文件夹里打开index.html显示空白的页面

你好,本人前端新手,这两天研究了下dva,感觉非常棒,准备用来做公司的管理系统试一试。但是遇到了下面这个问题:

npm start 之后的调试都没有问题,但是npm run build后,我理解的是打开index.html文件应该显示跟npm start时一样的页面,可是我这边一片空白,在Network里看3个文件也都在,不知道为什么?

node 7.0.0
roadhog 0.2.3

TypeError: Cannot read property 'page' of undefined

`我还按按照例子上做的,不知道是不是版本的问题,首先是路由要改,然后遇到了这个问题
123
我下载例子看了,返回的query如果没点分页是空对象,但是我自己的是undefined。

導入ant-Motion 出現錯誤

按照documentation步驟走的,不知道跟enquire依賴有什麼衝突?

Creating` dll bundle...
Failed to compile.

Module not found: Error: Cannot resolve module 'nstore' in E:\_javascript\dva-example-user-dash
board\node_modules\enquire\examples\data-integration

Locale provider

Hi, I'm following this tutorial and I was wondering how can I change the default language to spanish?.

I've seen this documentation https://ant.design/components/locale-provider but it doesn't show where should I do the changes so it's not very helpful, maybe that section of the documentation could be more explicit.

Thanks in advance for your help

下载完之后 NPM START 运行不起来

终端提示信息如下
G:\dva-example-user-dashboard-master>npm start

@ start G:\dva-example-user-dashboard-master
roadhog server

Failed to start the server, since you have enabled dllPlugin, but have not run roadhog buildDll before roadhog server.

列表获取的id,如果过长会这样:842996249664786432 -- >842996249664786400

id过长会自定截取变为00
export default async function request(url, options) {
console.log('opotions:'+options);
const response = await fetch(url, options);

/console.log(response);/
checkStatus(response);

const data = await response.json();

const ret = {
data,
headers: {},
};

if (response.headers.get('x-total-count')) {
ret.headers['x-total-count'] = response.headers.get('x-total-count');
}
console.log("ret:"+ret);
return ret;
}

request.js里面的方法, 列表查询:const data = await response.json();这句获取的id如果超过16位,比如18位,后两位就会变成00(如:842996249664786432 -- >842996249664786400)
不知道啥情况??

npm start 失败

错误如下:
这个例子,我感觉我是学不了.哈哈~
Failed to start the server, since you have enabled dllPlugin, but have not run roadhog buildDll before roadhog server.

按需加载css提取问题

执行build,indexPage和Users打包出的js文件中存在大量的 .ant-menu-... 等样式代码,请问如何把这些重复的代码提取到index.css中?
以前在webpack中是用ExtractTextPlugin提取,请问在dva roadhog中应该怎么配置?

开发模式下正常,npm run build后无法加载roadhog.dll.js

[Fri Sep 15 2017 10:08:34 GMT+0800 (CST)] "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
[Fri Sep 15 2017 10:08:34 GMT+0800 (CST)] "GET /roadhog.dll.js" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
[Fri Sep 15 2017 10:08:34 GMT+0800 (CST)] "GET /index.js" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
[Fri Sep 15 2017 10:08:34 GMT+0800 (CST)] "GET /roadhog.dll.js" Error (404): "Not found"

本地字体问题

请问:
如果要用本地字体文件,应该放在“public”还是“src/assets”目录下?
.roadhogrc:
{
"theme": {
"@icon-url": "'/assets/fonts/iconfont/iconfont'"
}
}
roadhog配置信息是这么写么?

run build打包后,页面空白

跑npm start的时候没问题,但是打包后加载,页面是空白的,也没有报错。
自己试了一下,发现是路由按需加载的require里并没有执行,网上找了方法,说是ES6的写法 要加.default,但是我自己试了,没有效果。

问个目录相关的问题

和 dva/React 相关的,假如下面场景:

有一个页面(Route Component),显示用户列表,然后有查看详情功能,点击列表项的“详情”按钮,就会出现一个弹层,弹层显示详情,详情是单独一个组件。

这样有两个文件:

UserList.jsx
UserDetail.jsx

假如UserList.jsx放到routes目录,那么UserDetail.jsx放到哪里呢?这个文件只在这里使用,我会放在components目录,但是有人问我“和UserList.jsx放到一起不是更合理一些,因为功能相关。

build生成的js文件使用问题

想请教下运行npm run build后生成的js文件如何使用?

我在静态文件index.html中添加以下script的引用:

`

<script src="index.js"></script> <script src="2.2.js"></script> <script src="1.1.js"></script>

`

其中2.2.js、1.1.js、index.js是build后生成的js。

使用浏览器查看index.html(未通过server),页面未显示预期的效果。以上问题出 在哪里,我还需要做哪些工作来正确使用build后的文件,多谢!

如果遇到创建或者编辑用户不生效可以试试这个方式

在请求的时候加上headers,这个贴出patch的代码,本人测试有效。
export function patch(id, values) {
return request(/api/users/${id}, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
// 'Access-Token': sessionStorage.getItem('access_token') || ''
},
body: JSON.stringify(values),
});

侧边栏菜单刷新问题

侧边栏刷新后的选中菜单消失,查看代码后发现是components/menus/index中handleClickNavMenu函数没有传进来,请看下

modify special style, but not customize theme

I want to modify special style, such as row padding of module Table body in .css or .scss. Do I need to import something?
My code:
.ant-table-tbody > tr > td {
padding: 13px 8px !important;
}

跑不起来

刚开始遇到编译失败的问题
手动调整roadhog为 "roadhog": "^1.2.2"
页面终于正常运行
但是 users页面依然无效,报错信息如下

ReferenceError: regeneratorRuntime is not defined
Stack trace:
request<@webpack-internal:///552:15:7
@webpack-internal:///552:14:15
[552]@http://localhost:8000/2.async.js:55:1
webpack_require@http://localhost:8000/index.js:708:12
fn@http://localhost:8000/index.js:113:20
@webpack-internal:///551:11:16
[551]@http://localhost:8000/2.async.js:47:1
webpack_require@http://localhost:8000/index.js:708:12
fn@http://localhost:8000/index.js:113:20
@webpack-internal:///414:13:14
[414]@http://localhost:8000/2.async.js:7:1
webpack_require@http://localhost:8000/index.js:708:12
fn@http://localhost:8000/index.js:113:20

子路由如何配置呢

const routes = [
    {
      path: '/',
      component: App,
      breadcrumbName: '首页',
      getIndexRoute(nextState, cb) {
        require.ensure([], require => {
          cb(null, {component: require('./routes/indexPage')})
        }, 'index')
      },
      childRoutes: [
        {
          path: '/user',
          breadcrumbName: '用户列表',
          getComponents(nextState, cb) {
            require.ensure([], require => {
              registerModel(app, require('./models/user'))
              cb(null, require('./routes/user/list/'))
            }, 'user')
          },
          childRoutes:[
            {
              path: ':id',
              breadcrumbName: '用户:id',
              getComponents(nextState, cb) {
                require.ensure([], require => {
                  //registerModel(app, require('./models/user'))
                  cb(null, require('./routes/user/detail/'))
                }, 'user')
              },
            },
          ]
        },  {
          path: '*',
          breadcrumbName: 'error',
          getComponent(nextState, cb) {
            require.ensure([], require => {
              cb(null, require('./routes/error/'))
            }, 'error')
          }
        }
      ]
    }
  ];

这时候 :id这个路由的component 渲染不出来,依然是 list

I just wanna to know where are you get the mock/fake data ???

import request from '../utils/request';
// request(url, options)
import { PAGE_SIZE } from '../constants';
// 分页 size 3


// http://localhost:8000/sockjs-node/info?t=1499839053437
// GET
// ??? where  are you get the mock/fake datas ??? 

export function fetch({ page }) {
    // http://localhost:8000/users?page=2
    // http://localhost:8000/api/users?_page=2&_limit=3
    // GET
    return request(`/api/users?_page=${page}&_limit=${PAGE_SIZE}`);
}


// http://localhost:8000/api/users/4
// DELETE
export function remove(id) {
    return request(`/api/users/${id}`, {
        method: 'DELETE'
    });
}

// http://localhost:8000/api/users/4
// PATCH
export function patch(id, values) {
    return request(`/api/users/${id}`, {
        method: 'PATCH',
        body: JSON.stringify(values)
    });
}

// http://localhost:8000/api/users/4
// POST
export function create(values) {
    return request('/api/users', {
        method: 'POST',
        body: JSON.stringify(values)
    });
}

访问报<Router> may have only one child element错误

11:40 Uncaught Error: A may have only one child element
at invariant (11:40)
at Router.componentWillMount (95:72)
at eval (412:347)
at measureLifeCyclePerf (412:75)
at ReactCompositeComponentWrapper.performInitialMount (412:346)
at ReactCompositeComponentWrapper.mountComponent (412:257)
at Object.mountComponent (50:45)
at ReactCompositeComponentWrapper.performInitialMount (412:370)
at ReactCompositeComponentWrapper.mountComponent (412:257)
at Object.mountComponent (50:45)

创建用户、编辑用户不生效

使用本地json-server时,编辑用户创建用户操作不生效;
需要在访问request方法时,初始化options参数的headers
文件:services/user.js

export function patch(id, values) {
  return request(`/api/users/${id}`, {
    method: 'PATCH',
    body: JSON.stringify(values),
    headers: {
      "Content-Type": "application/json"
    },
  });
}

export function create(values) {
  return request('/api/users', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify(values),
  });
}

使用线上json-server时,编辑用户创建用户操作始终不生效;

切换分页数据无变化

手动改这里是可以看到数据改变的
*fetch({ payload: { page = 1 } }, { call, put }) {
const { data, headers } = yield call(usersService.fetch, { page });
yield put({
type: 'save',
payload: {
data,
total: parseInt(headers['x-total-count'], 10),
page: parseInt(page, 10),
},
});
},

跑步起来

Failed to start the server, since you have enabled dllPlugin, but have not run roadhog buildDllbeforeroadhog server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.