我想问一下要怎么才能使运行我的这个html页面出结果?我运行了,但没有结果
//我的html页面:
<html>
<head>
<title>test demo</title>
</head>
<body>
<div id='a'></div>
<script type='text/javacript' src="nice.js">
</script>
</body>
</html>
//我的js页面:
import React, {PropTypes} from "react";//重点是引用包是怎么回事?这样引用了之后感觉没用啊?这样写了代码之后要怎么操作才会有作用?能帮忙详细的解释吗?谢谢!
import {browserHistory, Link} from 'react-router'
import {Form, Button, Input} from "antd";
const FormItem = Form.Item;
function noop() {
return false;
}
const formItemLayout = {
labelCol: {span: 7},
wrapperCol: {span: 12},
};
class SigninForm extends React.Component {
static propTypes = {
history: PropTypes.object.isRequired
};
static defaultProps = {
formStyle: {
width: "450px",
height: "380px",
margin: "auto",
background: "fff",
paddingTop: "120px"
}
};
handleSubmit(e) {
e.preventDefault();
const value = this.props.form.getFieldsValue();
this.props.action.signin(value);
}
componentWillReceiveProps(nextProps) {
if (this.props.sign !== nextProps.sign) {
const user = nextProps.sign.get('user');
if (user && user !== this.props.sign.get('user')) {
browserHistory.push('/console/')
} else if (nextProps.sign.has('signinError')) {
this.props.form.setFieldsValue({password: ''});
window.alert(nextProps.sign.getIn(['signinError', 'errMsg']));
}
}
}
render() {
const {getFieldDecorator} = this.props.form;
return (
<Form style={this.props.formStyle} horizontal onSubmit={this.handleSubmit.bind(this)}>
<FormItem
{...formItemLayout}
label="用户名"
hasFeedback>
{getFieldDecorator('account', {})(
<Input />
)}
</FormItem>
<FormItem
{...formItemLayout}
label="密码"
hasFeedback>
{getFieldDecorator('password', {
rules: [
{required: true, whitespace: true, message: '请填写密码'}
],
})(
<Input type="password" autoComplete="off"
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop}/>
)}
</FormItem>
<FormItem wrapperCol={{span: 12, offset: 7}}>
<Button type="ghost"
onClick={e => browserHistory.push('/console/sign/signup')}>没有创建?创建</Button>
<Button type="primary" htmlType="submit">登录</Button>
</FormItem>
</Form>
)
}
}
SigninForm = Form.create({})(SigninForm);
export default SigninForm;