Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改了不能输入的bug,下拉菜单改为点击触发 #12

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/pages/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const MainLayout: React.FC = () => {
<div style={{ display: 'flex', alignItems: 'center' }}>
<UserOutlined style={{ fontSize: '24px', marginRight: '8px' }} />
<span>你好, {username}</span>
<Dropdown menu={{items}}>
<Dropdown menu={{items}} trigger={['click']}>
<a onClick={e => e.preventDefault()} style={{ marginLeft: '8px' }}>
<DownOutlined />
</a>
Expand Down
27 changes: 11 additions & 16 deletions frontend/src/pages/NotePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ import '../css/NotePage.css'
const { Content } = Layout;
const { Panel } = Collapse;

class NoteList extends React.Component<{}> {
class NoteList extends React.Component {
state = {
value: ''
};

newNoteInfo = {
title: '',
content: ''
};


handleChange = (value: string) => {
this.setState({ value });
handleTitleChange = (e: any) => {
this.setState({ title: e.target.value });
}

handleContentChange = (value: any) => {
this.setState({ content: value });
}

render() {
return (
Expand All @@ -39,19 +37,16 @@ class NoteList extends React.Component<{}> {
<Input
placeholder="请输入笔记名称"
style={{ width: 200, marginRight: 10, marginBottom: 10 }}
value={this.newNoteInfo.title}
onChange={(e) => {
this.newNoteInfo.title = e.target.value;
}}
value={this.state.title}
onChange={this.handleTitleChange}
/>
{/* TODO: Button的触发 */}
<Button>添加</Button>
</div>
<div>
<ReactQuill
theme="snow"
value={this.newNoteInfo.content}
onChange={this.handleChange}
value={this.state.content}
onChange={this.handleContentChange}
modules={{
toolbar: [
["bold", "italic", "underline", "strike"], // toggled buttons
Expand Down Expand Up @@ -82,4 +77,4 @@ class NoteList extends React.Component<{}> {
}
}

export default NoteList;
export default NoteList;
Loading