我想在登录后在我的容器"LoginPage"(智能组件)重定向中使用.像这样的东西:
handleSubmit(username, pass, nextPath) {
function redirect() {
this.props.pushState(null, nextPath);
}
this.props.login(username, pass, redirect); //action from LoginAcitons
}
Run Code Online (Sandbox Code Playgroud)
用户名和密码从dumb-component到达.
智能组件连接
function mapStateToProps(state) {
return {
user: state.app.user
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(LoginActions, dispatch)
}
Run Code Online (Sandbox Code Playgroud)
如何从redux-router添加pushState?或者我错了路?
export default connect(mapStateToProps, {pushState})(LoginPage); //works, but haven't actions
export default connect(mapStateToProps, mapDispatchToProps)(LoginPage); //works, but haven't pushState
export default connect(mapStateToProps, mapDispatchToProps, {pushState})(LoginPage); //Uncaught TypeError: finalMergeProps is not a function
Run Code Online (Sandbox Code Playgroud) 我无法找到一个我错的地方.
我的.eslintrc
{
"extends": "eslint:recommended",
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"plugins": [
"react"
],
"rules": {
"no-console": 0,
"new-cap": 0,
"strict": 0,
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"eol-last": 0,
"quotes": [2, "single"],
"jsx-quotes": 1,
"react/jsx-no-undef": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1
}
}
Run Code Online (Sandbox Code Playgroud)
关于lint的webpack.config部分:
preLoaders: [
{
test: /\.js$/,
loaders: ['eslint'],
include: [
path.resolve(__dirname, "src"),
],
}
],
Run Code Online (Sandbox Code Playgroud)
和我的组件
import React, { PropTypes, Component } from 'react'
export default class User extends Component {
render() {
const { …
Run Code Online (Sandbox Code Playgroud) 如何从免费的拉斐尔图标改变图标的宽度和高度?
我尝试使用attr
,试图使用%
,像这样var paper = Raphael("canvas", 100%, 100%);
.
我需要这样做:如果我改变父块的大小,我的图标的大小也会改变.
upd:我尝试使用"scale"和"transform",但是图标从中心调整大小并且不能正确地适合父级
在docs - headerRowRenderer中,但任何人都可以与一些自定义标头标记共享简单示例,例如使用自定义title
attr +所有"默认"虚拟化功能,例如可排序...
我试图理解 中的事件camanjs
,但我需要一些例子。每个人都可以给我写一个简单的例子:
1)加载图像到canvas
(完成)
Caman("#canvas-img2", base64_or_path_to_image, function () {
this.nostalgia();
this.render();
});
Run Code Online (Sandbox Code Playgroud)
2)监听结束过滤,for callback
withthis.toBase64()
在文档中,我找到了事件页面,但不明白它是如何工作的。
我有一个带有react和redux的应用程序。我的测试引擎是- 柴
在我的reducer(src / my_reducer.js)中,我尝试像这样从localStorage获取令牌:
const initialState = {
profile: {},
token: window.localStorage.getItem('id_token') ? window.localStorage.getItem('id_token') : null,
}
Run Code Online (Sandbox Code Playgroud)
在我的测试文件(test / reducer_spec.js)中,我在测试用例之前导入了“ my_reducer”:
import myReducer from '../src/my_reducer'
Run Code Online (Sandbox Code Playgroud)
而且,如果我尝试运行test-localStorage(或window.localStorage)-未定义,则会出错。
我需要模拟localStorage吗?如果需要的话,去哪里?